From 6ed444cd7666473ef3c100cc157a0fc92afba1f6 Mon Sep 17 00:00:00 2001 From: Eli Mallon Date: Thu, 30 Jul 2026 15:13:19 -0700 Subject: [PATCH] reposync: always say where a retry wait came from Ladder-shaped waits on 429s look like ignored backoff headers unless the log says otherwise. waitSource is now always present: retry-after or ratelimit-reset when the server gave a number, none when the response carried no backoff headers at all -- which is what the HTML-bodied 429s from the bsky.network edge tier send, per-PDS ratelimit headers notwithstanding. Co-Authored-By: Claude Fable 5 --- pkg/reposync/retry.go | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/pkg/reposync/retry.go b/pkg/reposync/retry.go index 18924f2a0..17cc4b840 100644 --- a/pkg/reposync/retry.go +++ b/pkg/reposync/retry.go @@ -146,14 +146,16 @@ func (p RetryPolicy) do(ctx context.Context, what string, fn func() error) error return fmt.Errorf("giving up after %d attempts: %w", attempt, err) } d, source := p.delay(attempt, err) - kv := []any{"call", what, "attempt", attempt, "wait", d} - if source != "" { - // Worth saying out loud: it is the difference between "we guessed" - // and "the host told us", which is the first thing an operator - // looking at a throttled sweep wants to know. - kv = append(kv, "waitSource", source) + // Worth saying out loud either way: "the host told us" versus "the + // response carried no backoff headers, so we guessed" is the first + // thing an operator looking at a throttled sweep wants to know -- + // ladder-shaped waits with waitSource=none mean the server gave us + // nothing to obey, not that we ignored it. + if source == "" { + source = "none" } - kv = append(kv, "err", errForLog(err)) + kv := []any{"call", what, "attempt", attempt, "wait", d, "waitSource", source, + "err", errForLog(err)} log.Warn(ctx, "retrying transient xrpc failure", kv...) if serr := sleepCtx(ctx, d); serr != nil { return fmt.Errorf("aborted after %d attempts: %w", attempt, errors.Join(err, serr)) -- 2.51.2