Skip to content

Retry middleware consumes generator exception filters after the first error #708

Open

Description

@IlyaKhalafi

Both retry middleware constructors accept Iterable exception types. Passing a generator retries the first matching error but silently stops retrying later tasks because the generator has been consumed.

from taskiq.middlewares import SimpleRetryMiddleware

middleware = SimpleRetryMiddleware(
    default_retry_label=True,
    types_of_exceptions=(kind for kind in [ValueError]),
)

A native probe calling on_error with two independent ValueError messages sends only one retry. SmartRetryMiddleware has the same behavior. The filter should keep working for subsequent errors.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions