Open jamie-chang-globality opened 7 months ago
I've managed to create a workaround by overriding the retries middleware to skip shutdown exceptions
from dramatiq.middleware import Retries as OriginalRetries, Shutdown
class Retries(OriginalRetries):
def after_process_message(self, broker, message, *, result=None, exception=None):
if exception and isinstance(exception, Shutdown):
message.fail()
return
return super().after_process_message(broker, message, result=result, exception=exception)
Issues
GitHub issues are for bugs. If you have questions, please ask them on the mailing list.
Checklist
What OS are you using?
macOS 14.1
What version of Dramatiq are you using?
1.16.0
What did you do?
Setup a dramatiq project with Retries and ShutdownNotification middlewares Run a tasks on the worker Interrupt the worker with ctrl-c or otherwise
What did you expect would happen?
No retries being attempted
What happened?
Retries being attempted but shutdown does happen. For async tasks the problem is more severe as the retry is carried out so it delays the shutdown.
Reproduce
Create two actors
Run the actors with a broker that includes the following middleware
and ctrl-c to trigger shutdown