Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set max retries relay retry, not max try #1510

Merged
merged 1 commit into from
Mar 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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