mirror of
https://github.com/owncast/owncast.git
synced 2024-11-25 14:20:54 +03:00
Fix cleanup. ticker -> timer and stop reinstantiation
This commit is contained in:
parent
0cb31644f4
commit
cb2794f68c
1 changed files with 7 additions and 7 deletions
10
core/core.go
10
core/core.go
|
@ -18,7 +18,7 @@ import (
|
||||||
var (
|
var (
|
||||||
_stats *models.Stats
|
_stats *models.Stats
|
||||||
_storage models.ChunkStorageProvider
|
_storage models.ChunkStorageProvider
|
||||||
_cleanupTicker *time.Ticker
|
_cleanupTimer *time.Timer
|
||||||
)
|
)
|
||||||
|
|
||||||
//Start starts up the core processing
|
//Start starts up the core processing
|
||||||
|
@ -59,11 +59,11 @@ func createInitialOfflineState() error {
|
||||||
}
|
}
|
||||||
|
|
||||||
func startCleanupTimer() {
|
func startCleanupTimer() {
|
||||||
_cleanupTicker := time.NewTicker(5 * time.Minute)
|
_cleanupTimer = time.NewTimer(5 * time.Minute)
|
||||||
go func() {
|
go func() {
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
case <-_cleanupTicker.C:
|
case <-_cleanupTimer.C:
|
||||||
resetDirectories()
|
resetDirectories()
|
||||||
ffmpeg.ShowStreamOfflineState()
|
ffmpeg.ShowStreamOfflineState()
|
||||||
}
|
}
|
||||||
|
@ -73,8 +73,8 @@ func startCleanupTimer() {
|
||||||
|
|
||||||
// StopCleanupTimer will stop the previous cleanup timer
|
// StopCleanupTimer will stop the previous cleanup timer
|
||||||
func stopCleanupTimer() {
|
func stopCleanupTimer() {
|
||||||
if _cleanupTicker != nil {
|
if _cleanupTimer != nil {
|
||||||
_cleanupTicker.Stop()
|
_cleanupTimer.Stop()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue