From de6911fb05322575a9b2b3e5ac7ddd8d4328b875 Mon Sep 17 00:00:00 2001 From: disqualifier Date: Sun, 28 Jun 2026 17:18:28 -0400 Subject: [PATCH] fix: retry log uses total attempts as the denominator the retry warning logged index/last_index (attempts-1), so a 3-attempt retry showed 'retry 1/2'. now logs index+1 of attempts. both retry and aretry. Signed-off-by: disqualifier --- README.md | 4 ++-- src/commons/retry.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index ff11391..5badded 100644 --- a/README.md +++ b/README.md @@ -12,9 +12,9 @@ Small sync helpers shared across projects. Base is stdlib only — **no dependen ## Install ``` -commons @ git+ssh://git@git.rethinkstudios.io/rethink-public/commons.git@v0.2.0 +commons @ git+ssh://git@git.rethinkstudios.io/rethink-public/commons.git@v0.2.1 # async address/geo lookups (fetch_ip / ip_location / fetch_location) need the extra: -commons[addr] @ git+ssh://git@git.rethinkstudios.io/rethink-public/commons.git@v0.2.0 +commons[addr] @ git+ssh://git@git.rethinkstudios.io/rethink-public/commons.git@v0.2.1 ``` The base install pulls **nothing** (stdlib). Only `commons[addr]` adds `aiohttp`, and diff --git a/src/commons/retry.py b/src/commons/retry.py index 257669b..d12ecb2 100644 --- a/src/commons/retry.py +++ b/src/commons/retry.py @@ -96,7 +96,7 @@ def retry( wait = _jittered(delays[index], jitter, rand) log.warning( "retry %d/%d after %s: %s", - index + 1, last_index, type(exc).__name__, exc, + index + 1, attempts, type(exc).__name__, exc, ) if wait > 0: sleep(wait) @@ -149,7 +149,7 @@ def aretry( wait = _jittered(delays[index], jitter, rand) log.warning( "retry %d/%d after %s: %s", - index + 1, last_index, type(exc).__name__, exc, + index + 1, attempts, type(exc).__name__, exc, ) if wait > 0: await sleep(wait)