Skip to content
This repository has been archived by the owner on Jan 9, 2024. It is now read-only.

Commit

Permalink
Fix detecting when it is the last attempt
Browse files Browse the repository at this point in the history
- SlotNotCoveredError, was re-raising the exception one attempt too soon.
- Similarly log_exception
  • Loading branch information
JonathanWylie committed Aug 19, 2021
1 parent bb865ed commit 1982253
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions rediscluster/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -590,7 +590,7 @@ def _execute_command(self, *args, **kwargs):
connection_error_retry_counter = 0

def log_exception(message, exception):
if ttl == 1:
if ttl == 0:
# This is the last attempt before we run out of TTL, so log the full exception.
log.exception(message)
else:
Expand Down Expand Up @@ -647,7 +647,7 @@ def log_exception(message, exception):
time.sleep(0.1)

# This is the last attempt before we run out of TTL, raise the exception
if ttl == 1:
if ttl == 0:
raise e
except (RedisClusterException, BusyLoadingError):
log.exception("RedisClusterException || BusyLoadingError")
Expand Down

0 comments on commit 1982253

Please sign in to comment.