mirror of
https://github.com/lukaszraczylo/traefikoidc.git
synced 2026-10-15 04:18:03 +00:00
fixup! fixup! fixup! Weekend fun with further optimisations.
This commit is contained in:
@@ -449,3 +449,25 @@ func GetGlobalMemoryMonitor() *MemoryMonitor {
|
||||
})
|
||||
return globalMemoryMonitor
|
||||
}
|
||||
|
||||
// ResetGlobalMemoryMonitor resets the global memory monitor for testing
|
||||
// This should only be used in tests to prevent state pollution between tests
|
||||
func ResetGlobalMemoryMonitor() {
|
||||
globalMonitoringMutex.Lock()
|
||||
defer globalMonitoringMutex.Unlock()
|
||||
|
||||
if globalMemoryMonitor != nil {
|
||||
// Stop monitoring if it's active
|
||||
if globalMonitoringStarted {
|
||||
registry := GetGlobalTaskRegistry()
|
||||
if task, exists := registry.GetTask("memory-monitor"); exists {
|
||||
task.Stop()
|
||||
}
|
||||
}
|
||||
globalMemoryMonitor = nil
|
||||
}
|
||||
|
||||
// Reset the singleton state
|
||||
globalMemoryMonitorOnce = sync.Once{}
|
||||
globalMonitoringStarted = false
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user