-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
retry strategy triggered by any Exception except the ones listed #479
Comments
I think we could introduce a def get_schedule_in(self, *, exception: Exception, attempts: int) -> Optional[int]:
if self.max_attempts and attempts >= self.max_attempts:
return None
if self.retry_exceptions and not isinstance(
exception,
tuple(self.retry_exceptions)
):
return None
if self.no_retry_exceptions and isinstance(
exception,
tuple(self.no_retry_exceptions)
):
return None
… Not that with this code if the exception is both a "retry exception" and a "no retry exception" then there will be no retry. And if the exception is neither a "retry exception" nor a "no retry exception" there will be no retry either. In other words if there's ambiguity "no retry" is favored over "retry". |
(I think we could raise if
|
could this be implemented just subclassing |
Yep, agree. |
Yes I think so. Though it make sense to add this to the procrastinate lib, feel free to implement this on your side in the meantime. And/or to contribute to the lib :) |
See https://docs.python.org/3/library/typing.html#typing.overload to properly indicate with mypy that arguments are mutually exclusive |
Hi, thanks for this project guys!
I was wondering if is there a way to create a retry strategy that instead of retrying for some listed exceptions it'd retry for any Exception except the ones listed, so basically it's the inverse logic currently used.
I was checking the
BaseRetryStrategy
class but it seems to me that it doesn't manage the logic for selecting which exceptions should be retried.Thanks.
The text was updated successfully, but these errors were encountered: