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

Method Debounce

coderd/database/modelmethods.go:871–883  ·  view source on GitHub ↗
(
	by time.Duration,
	now time.Time,
	oldState, newState WorkspaceAgentMonitorState,
)

Source from the content-addressed store, hash-verified

869}
870
871func (m WorkspaceAgentMemoryResourceMonitor) Debounce(
872 by time.Duration,
873 now time.Time,
874 oldState, newState WorkspaceAgentMonitorState,
875) (time.Time, bool) {
876 if now.After(m.DebouncedUntil) &&
877 oldState == WorkspaceAgentMonitorStateOK &&
878 newState == WorkspaceAgentMonitorStateNOK {
879 return now.Add(by), true
880 }
881
882 return m.DebouncedUntil, false
883}
884
885func (m WorkspaceAgentVolumeResourceMonitor) Debounce(
886 by time.Duration,

Callers 2

monitorMemoryMethod · 0.45
monitorVolumesMethod · 0.45

Calls 1

AddMethod · 0.65

Tested by

no test coverage detected