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

Method heartbeatInterval

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

heartbeatInterval returns a safe ticker interval for stream heartbeats. It is half the stale threshold so at least one touch lands before the stale sweep considers the row abandoned. The result is clamped to a minimum of 1 ms to prevent panics from time.NewTicker(0) with pathologically small thresh

()

Source from the content-addressed store, hash-verified

206// pathologically small thresholds, while still staying well below any
207// practical stale timeout.
208func (s *Service) heartbeatInterval() time.Duration {
209 return max(s.staleThreshold()/2, time.Millisecond)
210}
211
212func chatdContext(ctx context.Context) context.Context {
213 //nolint:gocritic // AsChatd provides narrowly-scoped daemon access for

Callers 1

launchHeartbeatFunction · 0.80

Calls 1

staleThresholdMethod · 0.95

Tested by

no test coverage detected