From cb2794f68c029cd205addd9d5a97fe5b16c92d10 Mon Sep 17 00:00:00 2001 From: Gabe Kangas Date: Wed, 23 Sep 2020 21:35:27 -0700 Subject: [PATCH] Fix cleanup. ticker -> timer and stop reinstantiation --- core/core.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/core/core.go b/core/core.go index cdfdecac1..01de48da3 100644 --- a/core/core.go +++ b/core/core.go @@ -16,9 +16,9 @@ import ( ) var ( - _stats *models.Stats - _storage models.ChunkStorageProvider - _cleanupTicker *time.Ticker + _stats *models.Stats + _storage models.ChunkStorageProvider + _cleanupTimer *time.Timer ) //Start starts up the core processing @@ -59,11 +59,11 @@ func createInitialOfflineState() error { } func startCleanupTimer() { - _cleanupTicker := time.NewTicker(5 * time.Minute) + _cleanupTimer = time.NewTimer(5 * time.Minute) go func() { for { select { - case <-_cleanupTicker.C: + case <-_cleanupTimer.C: resetDirectories() ffmpeg.ShowStreamOfflineState() } @@ -73,8 +73,8 @@ func startCleanupTimer() { // StopCleanupTimer will stop the previous cleanup timer func stopCleanupTimer() { - if _cleanupTicker != nil { - _cleanupTicker.Stop() + if _cleanupTimer != nil { + _cleanupTimer.Stop() } }