-
-
Notifications
You must be signed in to change notification settings - Fork 52
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
Fix InMemoryBroker to use startup and shutdown middleware hooks #358
base: master
Are you sure you want to change the base?
Fix InMemoryBroker to use startup and shutdown middleware hooks #358
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The request looks good to me. But I have a small question.
for handler in self.event_handlers.get( | ||
TaskiqEvents.CLIENT_STARTUP | ||
if self.is_worker_process | ||
else TaskiqEvents.WORKER_STARTUP, | ||
[], | ||
): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't it be reversed?
for handler in self.event_handlers.get( | |
TaskiqEvents.CLIENT_STARTUP | |
if self.is_worker_process | |
else TaskiqEvents.WORKER_STARTUP, | |
[], | |
): | |
for handler in self.event_handlers.get( | |
TaskiqEvents.WORKER_STARTUP | |
if self.is_worker_process | |
else TaskiqEvents.CLIENT_STARTUP, | |
[], | |
): |
TaskiqEvents.CLIENT_SHUTDOWN | ||
if self.is_worker_process | ||
else TaskiqEvents.WORKER_SHUTDOWN, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one as well.
TaskiqEvents.CLIENT_SHUTDOWN | |
if self.is_worker_process | |
else TaskiqEvents.WORKER_SHUTDOWN, | |
TaskiqEvents.WORKER_SHUTDOWN | |
if self.is_worker_process | |
else TaskiqEvents.CLIENT_SHUTDOWN, |
Hi,
This is the second patch I would like to introduce. Previously, we overrode the
startup
andshutdown
to ensure bothclient
andworker
events would be handled properly. However, this made InMemoryBroker unable to handlestartup
andshutdown
middleware hooks.This change brings the handling of
startup
andshutdown
middleware hooks back. Feel free to let me know if you have any concerns or suggestions!