Skip to content

Commit

Permalink
[IMP] don't remove the empty_backend but rather filter it
Browse files Browse the repository at this point in the history
  • Loading branch information
Guillaume Jeusel committed Feb 7, 2020
1 parent 2b453d3 commit f0ae464
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions flask_melodramatiq/lazy_broker.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,10 @@ def init_app(self, app):
"""

if self.__stub:
self.__options['middleware'] = self.__stub.middleware
self.__options['middleware'] = [
m for m in self.__stub.middleware
if m is not self.__empty_backend
]
configuration = self.__get_configuration(app)
self.__stub.close()
self.__stub = None
Expand All @@ -150,10 +153,6 @@ def init_app(self, app):
# Instanciate dramatiq Broker
broker = self._dramatiq_broker_factory(**options)

# Pull out empty backend from middleware
if self.__empty_backend in broker.middleware:
broker.middleware.remove(self.__empty_backend)

# Add Flask App Context Middleware
broker.add_middleware(AppContextMiddleware(app))

Expand Down

0 comments on commit f0ae464

Please sign in to comment.