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

Make event handlers non-blocking by default #51

Open
FichteFoll opened this issue Feb 13, 2020 · 0 comments
Open

Make event handlers non-blocking by default #51

FichteFoll opened this issue Feb 13, 2020 · 0 comments

Comments

@FichteFoll
Copy link
Member

FichteFoll commented Feb 13, 2020

Event handlers are currently executed in paralell fr the same priority, but in sequence overall and generally block the event queue until their completion. The intended workflow for non-blocking handlers is to create and schedule a task using the ReturnValue namedtuple, which the dispatcher waits for in the case the event handler needs to modify the event queue.

However, this use case is much more likely than modifying the queue and should thus be the default in order to reduce boilerplate code for the 90% case.

I'm currently thinking of adding a keyword argument to the event decorator, but I'm a bit out of touch with the code base since I haven't touched it in 3 years. Regardless, I'm creating this issue to remind myself of the problem. I should note that by doing this, order of execution is not guaranteed, but that should be self-evident by the meaning of "non-blocking" and is really no different from the status quo when a task is "scheduled for later".

Also related reading (and what kind of lead me to this thought): https://lucumr.pocoo.org/2020/1/1/async-pressure/

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