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

Function WithClock

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

WithClock overrides the default real clock. Tests inject quartz.NewMock(t) to control time-dependent behavior such as heartbeat tickers and FinalizeStale timestamps.

(c quartz.Clock)

Source from the content-addressed store, hash-verified

74// quartz.NewMock(t) to control time-dependent behavior such as
75// heartbeat tickers and FinalizeStale timestamps.
76func WithClock(c quartz.Clock) ServiceOption {
77 return func(s *Service) {
78 if c != nil {
79 s.clock = c
80 }
81 }
82}
83
84// CreateRunParams contains friendly inputs for creating a debug run.
85type CreateRunParams struct {

Callers 1

TestLaunchHeartbeatFunction · 0.70

Calls

no outgoing calls

Tested by 1

TestLaunchHeartbeatFunction · 0.56