Browse Source

Fix cleanup. ticker -> timer and stop reinstantiation

pull/184/head
Gabe Kangas 5 years ago
parent
commit
cb2794f68c
  1. 10
      core/core.go

10
core/core.go

@ -18,7 +18,7 @@ import ( @@ -18,7 +18,7 @@ import (
var (
_stats *models.Stats
_storage models.ChunkStorageProvider
_cleanupTicker *time.Ticker
_cleanupTimer *time.Timer
)
//Start starts up the core processing
@ -59,11 +59,11 @@ func createInitialOfflineState() error { @@ -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() { @@ -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()
}
}

Loading…
Cancel
Save