From c8791f891751029fa08a84feefe685d6ff128f31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Brunner?= Date: Mon, 20 Mar 2023 13:25:45 +0100 Subject: [PATCH] Set max retries relay retry, not max try --- tilecloud/store/redis.py | 2 +- tilecloud/tests/test_redis.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tilecloud/store/redis.py b/tilecloud/store/redis.py index 01aa9727d..3bea33f1b 100644 --- a/tilecloud/store/redis.py +++ b/tilecloud/store/redis.py @@ -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, diff --git a/tilecloud/tests/test_redis.py b/tilecloud/tests/test_redis.py index 3bb76cb3f..f93088be1 100644 --- a/tilecloud/tests/test_redis.py +++ b/tilecloud/tests/test_redis.py @@ -103,7 +103,7 @@ def test_dropping_too_many_retries(store): 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)