mirror of
https://github.com/coder/coder.git
synced 2025-07-03 16:13:58 +00:00
chore: implement oom/ood processing component (#16436)
Implements the processing logic as set out in the OOM/OOD RFC.
This commit is contained in:
@ -527,3 +527,31 @@ func (k CryptoKey) CanVerify(now time.Time) bool {
|
||||
func (r GetProvisionerJobsByOrganizationAndStatusWithQueuePositionAndProvisionerRow) RBACObject() rbac.Object {
|
||||
return r.ProvisionerJob.RBACObject()
|
||||
}
|
||||
|
||||
func (m WorkspaceAgentMemoryResourceMonitor) Debounce(
|
||||
by time.Duration,
|
||||
now time.Time,
|
||||
oldState, newState WorkspaceAgentMonitorState,
|
||||
) (time.Time, bool) {
|
||||
if now.After(m.DebouncedUntil) &&
|
||||
oldState == WorkspaceAgentMonitorStateOK &&
|
||||
newState == WorkspaceAgentMonitorStateNOK {
|
||||
return now.Add(by), true
|
||||
}
|
||||
|
||||
return m.DebouncedUntil, false
|
||||
}
|
||||
|
||||
func (m WorkspaceAgentVolumeResourceMonitor) Debounce(
|
||||
by time.Duration,
|
||||
now time.Time,
|
||||
oldState, newState WorkspaceAgentMonitorState,
|
||||
) (debouncedUntil time.Time, shouldNotify bool) {
|
||||
if now.After(m.DebouncedUntil) &&
|
||||
oldState == WorkspaceAgentMonitorStateOK &&
|
||||
newState == WorkspaceAgentMonitorStateNOK {
|
||||
return now.Add(by), true
|
||||
}
|
||||
|
||||
return m.DebouncedUntil, false
|
||||
}
|
||||
|
Reference in New Issue
Block a user