Skip to content

Runtime not consistently using default handlers #47

@austinwarner-8451

Description

@austinwarner-8451

Any default handlers that are registered after the first request is run in a thread will be ignored. This is because the Runtime instance makes a copy of the default handlers when instantiated, so any new ones that are registered after the fact are not available to it.

MRE

from labrea.runtime import Request, current_runtime

_ = current_runtime() # Make sure a runtime is initialized

class VoidRequest(Request[None]):
    def __init__(self):
        pass

@VoidRequest.handle
def void_handler(request: VoidRequest) -> None:
    return

VoidRequest().run() # This raises an error for no handler registered

Metadata

Metadata

Labels

bugSomething isn't working

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions