From 234cde70ef01a4327e5a3df3ec1b879148ad3aef Mon Sep 17 00:00:00 2001 From: Alec Thomas Date: Fri, 16 Jan 2026 12:10:08 +1100 Subject: [PATCH] fix: all requests triggered a ref check, resulting in a busy loop Since `refCheckValid` was `false`, the check would ALWAYS proceed, even if another request was already checking --- internal/strategy/git/backend.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/internal/strategy/git/backend.go b/internal/strategy/git/backend.go index 8c9160e..74904c5 100644 --- a/internal/strategy/git/backend.go +++ b/internal/strategy/git/backend.go @@ -153,6 +153,7 @@ func (s *Strategy) ensureRefsUpToDate(ctx context.Context, c *clone) error { return nil } c.lastRefCheck = time.Now() + c.refCheckValid = true c.mu.Unlock() logger.DebugContext(ctx, "Checking upstream for new refs", @@ -199,9 +200,9 @@ func (s *Strategy) ensureRefsUpToDate(ctx context.Context, c *clone) error { logger.InfoContext(ctx, "Upstream has new or updated refs, fetching") err = s.executeFetch(ctx, c) - if err == nil { + if err != nil { c.mu.Lock() - c.refCheckValid = true + c.refCheckValid = false c.mu.Unlock() } return err