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 <dev@disqualifier.me>
This commit is contained in:
disqualifier 2026-06-28 17:18:28 -04:00
parent c6e3dd1b54
commit de6911fb05
2 changed files with 4 additions and 4 deletions

View File

@ -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

View File

@ -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)