Skip to content

Commit

Permalink
Set max retries relay retry, not max try
Browse files Browse the repository at this point in the history
  • Loading branch information
sbrunner committed Mar 20, 2023
1 parent 428c3c1 commit 865ebf3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion tilecloud/store/redis.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ def _claim_olds(self) -> Tuple[Iterable[Tuple[bytes, Any]], bool]:
if int(pending["time_since_delivered"]) >= self._pending_timeout_ms:
id_ = pending["message_id"]
nb_retries = int(pending["times_delivered"])
if nb_retries < self._max_retries:
if nb_retries <= self._max_retries:
logger.info(
"A message has been pending for too long. Stealing it (retry #%d): %s",
nb_retries,
Expand Down
4 changes: 2 additions & 2 deletions tilecloud/tests/test_redis.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,12 @@ def test_dropping_too_many_retries(store):
count = 0
nb_tries = 0
# max_retries=2 => 2 iterations to have the error two times and a third one to drop the message
for _ in range(3):
for _ in range(4):
try:
for tile in store.list():
if tile.tilecoord.y == 0: # this tile always fails and will be dropped after two tries
nb_tries += 1
assert nb_tries <= 2
assert nb_tries <= 3
raise SlaveException
count += 1
store.delete_one(tile)
Expand Down

0 comments on commit 865ebf3

Please sign in to comment.