Skip to content

Retrying not working when executing Redis Pipeline for retry_on_error exceptions #2973

Closed
@jfcalcerrada

Description

@jfcalcerrada

Version: 4.3.6 to 5.0.1

Platform: 3.8 to 3.11

Description: redis-py does not attempt to reconnect when executing a pipeline for the errors provided in retry_on_error, instead the exceptions are bubbled up.

This library accepts a retry policy and a list of Errors/Exceptions to attempt a retry.

When executing a single command in the Sync and Async versions, it calls call_with_retry passing _disconnect_raise as a callback in the client.py and asyncio/client.py. In both cases, _disconnect_raise won't bubble up exceptions in the retry_on_error list. See:

As exceptions aren't bubbled up, retry will work as expected when calling that callback:

fail(error)

But this is not the case for Pipeline on both versions (Sync and Async). When executing a pipeline, this time the _disconnect_reset_raise callback is passed in call_with_retry:

def _disconnect_raise_reset(self, conn: Redis, error: Exception) -> None:

This callback DO bubble up all exceptions but TimeError, as the exception is bubbled up, call_with_retry will raise an exception when executing this line of code:

fail(error)

Thus bubbling up the exception all the way up, ignoring the retry_on_error list and the retry policy in place.

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