You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(gitter): fix fallback when rate limited (#5375)
#5299 adds reclone fallback at the first sign of trouble.
If gitter hits a rate limit from GitHub (or other hosts), the fallback
logic will make it attempt to reclone (which will still fail with 403).
This leaves us with no repo, which is worse than an outdated local repo.
This PR adds logic to skip the fallback attempt if the error is 403 and
log warning accordingly.
// If still failing or recovery wasn't attempted, reclone the repo as final fallback
542
550
iferr!=nil {
551
+
ifisForbiddenError(err) {
552
+
logger.WarnContext(ctx, "Fetch failed with 403 Forbidden. Using local repo.", slog.Duration("sinceLastFetch", time.Since(accessTime)), slog.Any("err", err))
553
+
returnnil
554
+
}
555
+
543
556
logger.WarnContext(ctx, "Fetch and reset failed after recovery attempt, deleting repo and recloning", slog.Any("err", err))
544
557
iferr:=os.RemoveAll(repoPath); err!=nil {
545
558
returnfmt.Errorf("failed to remove repo directory for reclone: %w", err)
@@ -732,7 +745,7 @@ func gitHandler(w http.ResponseWriter, r *http.Request) {
0 commit comments