MCPcopy Create free account
hub / github.com/easyp-tech/server / sweepMisses

Method sweepMisses

internal/connect/commits.go:965–987  ·  view source on GitHub ↗

sweepMisses periodically drops expired negative-cache entries so missCache cannot grow without bound as distinct bogus shas arrive. Intended to run in a background goroutine; the interval is half the TTL (Nyquist-ish). Stops only when the process exits (no graceful-shutdown context exists).

(ctx context.Context)

Source from the content-addressed store, hash-verified

963// a background goroutine; the interval is half the TTL (Nyquist-ish). Stops
964// only when the process exits (no graceful-shutdown context exists).
965func (h *commitServiceHandler) sweepMisses(ctx context.Context) {
966 interval := h.probeNegativeTTL / 2
967 if interval <= 0 {
968 return
969 }
970 t := time.NewTicker(interval)
971 defer t.Stop()
972 for {
973 select {
974 case <-ctx.Done():
975 return
976 case now := <-t.C:
977 cutoff := now
978 h.commitMu.Lock()
979 for sha, t := range h.missCache {
980 if cutoff.Sub(t) >= h.probeNegativeTTL {
981 delete(h.missCache, sha)
982 }
983 }
984 h.commitMu.Unlock()
985 }
986 }
987}
988
989// probeCommitID resolves a Download commit_id (= git sha) that was neither
990// minted in-session nor recoverable by the single-module fallback, by asking

Callers 1

NewWithConfigFunction · 0.95

Calls 2

UnlockMethod · 0.80
LockMethod · 0.65

Tested by

no test coverage detected