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

Function TrackerWithTickFlush

coderd/workspacestats/tracker.go:91–100  ·  view source on GitHub ↗

TrackerWithTickFlush allows passing two channels: one that reads a time.Time, and one that returns the number of marked workspaces every time Tracker flushes. For testing only and will panic if used outside of tests.

(tickCh <-chan time.Time, flushCh chan int)

Source from the content-addressed store, hash-verified

89// every time Tracker flushes.
90// For testing only and will panic if used outside of tests.
91func TrackerWithTickFlush(tickCh <-chan time.Time, flushCh chan int) TrackerOption {
92 if flag.Lookup("test.v") == nil {
93 panic("developer error: WithTickFlush is not to be used outside of tests.")
94 }
95 return func(h *UsageTracker) {
96 h.tickCh = tickCh
97 h.stopTick = func() {}
98 h.flushCh = flushCh
99 }
100}
101
102// Add marks the workspace with the given ID as having been used recently.
103// Tracker will periodically flush this to its configured Store.

Callers 5

NewOptionsFunction · 0.92
TestTrackerFunction · 0.92
TestUpdateStatsFunction · 0.92

Calls

no outgoing calls

Tested by 4

TestTrackerFunction · 0.74
TestUpdateStatsFunction · 0.74