MCPcopy Index your code
hub / github.com/coder/coder / SetStaleAfter

Method SetStaleAfter

coderd/x/chatd/chatdebug/service.go:169–181  ·  view source on GitHub ↗

SetStaleAfter overrides the in-flight stale threshold used when finalizing abandoned debug rows. Zero or negative durations are ignored, leaving the current threshold (initial or previously overridden) unchanged. Active heartbeat goroutines are woken so they can re-read the (possibly shorter) interv

(staleAfter time.Duration)

Source from the content-addressed store, hash-verified

167// overridden) unchanged. Active heartbeat goroutines are woken so
168// they can re-read the (possibly shorter) interval immediately.
169func (s *Service) SetStaleAfter(staleAfter time.Duration) {
170 if s == nil || staleAfter <= 0 {
171 return
172 }
173 s.staleAfterNanos.Store(staleAfter.Nanoseconds())
174
175 // Wake all heartbeat goroutines by closing the current channel
176 // and replacing it with a fresh one for the next update.
177 s.thresholdMu.Lock()
178 close(s.thresholdChanged)
179 s.thresholdChanged = make(chan struct{})
180 s.thresholdMu.Unlock()
181}
182
183// thresholdChan returns the current threshold-change notification
184// channel. Heartbeat goroutines select on this to detect runtime

Callers 3

NewFunction · 0.95
TestLaunchHeartbeatFunction · 0.95

Calls 3

StoreMethod · 0.45
LockMethod · 0.45
UnlockMethod · 0.45