Skip to content

Fix InMemoryBroker to use startup and shutdown middleware hooks#629

Open
PythonFZ wants to merge 2 commits into
taskiq-python:masterfrom
PythonFZ:fix-inmem-broker-middleware
Open

Fix InMemoryBroker to use startup and shutdown middleware hooks#629
PythonFZ wants to merge 2 commits into
taskiq-python:masterfrom
PythonFZ:fix-inmem-broker-middleware

Conversation

@PythonFZ
Copy link
Copy Markdown

A copy/paste approach + test similar to #358

Instead of relying on super calls this PR just copy + pastes

taskiq/taskiq/abc/broker.py

Lines 196 to 198 in 9f8db96

for middleware in self.middlewares:
if middleware.__class__.startup != TaskiqMiddleware.startup:
await maybe_awaitable(middleware.startup())

and

taskiq/taskiq/abc/broker.py

Lines 217 to 219 in 9f8db96

for middleware in self.middlewares:
if middleware.__class__.shutdown != TaskiqMiddleware.shutdown:
await maybe_awaitable(middleware.shutdown())

into the methods of class InMemoryBroker(AsyncBroker) and adds a simple test case checking ensuring startup and shutdown work and the order of execution is correct.

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

Successfully merging this pull request may close these issues.

1 participant