Reputation: 47
For debugging purposes, I need to do a task (send an email) when some Channel Workers stops for an error.
I don't find a closure method that I could edit to add mi task in the SyncConsumer or AsyncConsumer.
channels==2.2.0 channels-redis==2.4.0
Upvotes: 0
Views: 58
Reputation: 2408
For a completely generic approach:
You can try overriding the Consumers __call__
method
async def __call__(self, receive, send):
try:
await super().__call__(receive, send):
except:
.... do your stuff
raise
Upvotes: 1