Open arseniiarsenii opened 12 months ago
I think it's also depends on Exception type. And passing (retries, exception)
to backoff_factory
will also consistent with retry_when
which already handle this parameters
I agree
Hey @arseniiarsenii I have a somewhat similar problem https://github.com/Bogdanp/dramatiq/issues/605 that implementation you suggested could resolve partially or fully.
Have you noticed in your tests that retry is performed more times than the specified limit?
What version of Dramatiq are you using?
1.14.2
Description
Right now we can provide per-actor settings for the retry policy using a predicate in the actor decorator's argument
retry_when
. However, there is no such option to override backoff times used for retrying tasks.The case: I am using an actor to send a webhook to an external service. We have agreed that a webhook should be retried three times if the first attempt fails. Second attempt after 1 minute, third attempt after 5 minutes, fourth attempt after an hour. It is not easy to implement such logic in dramatiq at the moment.
Having spent quite some time reading docs, issues, and sources I've come up with this workaround using
CurrentMessage
middleware:I think it should be easier to achieve this behavior using an argument similar to
retry_when
:Thank you for your work, I hope that this feature request makes it into a future release!