Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

record.done() assertion error #136

Open
flossypurse opened this issue Jan 28, 2025 · 1 comment
Open

record.done() assertion error #136

flossypurse opened this issue Jan 28, 2025 · 1 comment

Comments

@flossypurse
Copy link
Contributor

flossypurse commented Jan 28, 2025

Resonate (version 0.4.7) process exited with error:

Traceback (most recent call last):
  File "/Users/flossypurse/Resonate/nomnomnow/customers/.venv/lib/python3.12/site-packages/resonate/utils.py", line 28, in wrapper
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/Users/flossypurse/Resonate/nomnomnow/customers/.venv/lib/python3.12/site-packages/resonate/scheduler/scheduler.py", line 151, in _loop
    for loopback in self._step(cmd):
                    ^^^^^^^^^^^^^^^
  File "/Users/flossypurse/Resonate/nomnomnow/customers/.venv/lib/python3.12/site-packages/resonate/scheduler/scheduler.py", line 159, in _step
    return self._handle_invoke(cmd)
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/flossypurse/Resonate/nomnomnow/customers/.venv/lib/python3.12/site-packages/resonate/scheduler/scheduler.py", line 177, in _handle_invoke
    assert not record.done()
           ^^^^^^^^^^^^^^^^^
AssertionError
@flossypurse
Copy link
Contributor Author

Invocation from gateway nodes:

result = yield ctx.rfc('get_customer', order['customer_email']).options(
    send_to=poll('customers-service-nodes')
)

function that errors on customers-nodes

@resonate.register
def get_customer(ctx, customer_email):
    print(f"Getting customer with email {customer_email}")
    db = ctx.get_dependency("customer-db")
    try:
        stmt = db.cursor()
        stmt.execute("SELECT * FROM customers WHERE email = ?", (customer_email,))
        columns = [column[0] for column in stmt.description]
        # Fetch all rows and map them to dictionaries
        customers = [dict(zip(columns, row)) for row in stmt.fetchall()]
        if not customers:
            return {"success": False, "message": "Customer not found"}
        return {"success": True, "customer": customers[0], "message": "Customer found"}
    except Exception as e:
        print(f"Error retrieving customer: {str(e)}")
        raise Exception(f"Error retrieving customer: {str(e)}")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant