• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

stacklok / toolhive / 24497409662

16 Apr 2026 07:18AM UTC coverage: 65.803% (+0.05%) from 65.755%
24497409662

push

github

web-flow
Expand singleflight boundary in ValidatingCache.Get to cover full hit+check and miss+load path (#4798)

Move the singleflight.Do boundary to wrap the entire Get operation rather than
only the miss+load path. This coalesces concurrent liveness checks for the same
key into a single storage.Load round-trip, reducing storage pressure under
concurrent access.

With only one goroutine running per key at a time:
- ContainsOrAdd is replaced with plain Add — the concurrent-writer race between
  multiple Get goroutines no longer exists
- The ContainsOrAdd + Get race-handling block is removed entirely
- The onEvict field on the struct is removed (it was only needed to manually
  call the callback in the discarded-load path)

As a side effect of the new design, an expired cache hit now evicts the entry
and falls through to load within the same singleflight operation, returning the
fresh value instead of (zero, false).

Closes #4729

Co-authored-by: taskbot <taskbot@users.noreply.github.com>

35 of 38 new or added lines in 1 file covered. (92.11%)

7 existing lines in 3 files now uncovered.

57269 of 87031 relevant lines covered (65.8%)

61.98 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

93.83
/pkg/cache/validating_cache.go


Source Not Available

STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc