Skip to content

Fix InMemoryBroker to use startup and shutdown middleware hooks - #629

Merged
danfimov merged 2 commits into
taskiq-python:masterfrom
PythonFZ:fix-inmem-broker-middleware
Sep 15, 2026
Merged

danfimov merged 2 commits into
taskiq-python:masterfrom
PythonFZ:fix-inmem-broker-middleware

Conversation

@PythonFZ

Copy link
Copy Markdown
Contributor

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.

@PythonFZ

PythonFZ commented Jul 22, 2026

Copy link
Copy Markdown
Contributor Author

@s3rius Thanks for approving the PR. Could you re-run the CI / merge main again. The error doesn't seem to be related to the changed I made.

@codecov

codecov Bot commented Jul 22, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 82.87%. Comparing base (c4b8666) to head (979eb13).

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #629      +/-   ##
==========================================
+ Coverage   82.63%   82.87%   +0.23%     
==========================================
  Files          69       69              
  Lines        2730     2739       +9     
==========================================
+ Hits         2256     2270      +14     
+ Misses        474      469       -5     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@danfimov
danfimov force-pushed the fix-inmem-broker-middleware branch from a62189e to 979eb13 Compare September 15, 2026 21:26
@danfimov
danfimov merged commit 06c4f36 into taskiq-python:master Sep 15, 2026
35 checks passed
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.

3 participants