remove global variables from core/storageproviders (#1444)

This commit is contained in:
Tim Cooper
2021-10-11 18:29:36 -05:00
committed by GitHub
parent 8098304967
commit 9a912d5385
3 changed files with 28 additions and 17 deletions

View File

@@ -11,18 +11,22 @@ import (
// LocalStorage represents an instance of the local storage provider for HLS video.
type LocalStorage struct {
// Cleanup old public HLS content every N min from the webroot.
onlineCleanupTicker *time.Ticker
}
// Cleanup old public HLS content every N min from the webroot.
var _onlineCleanupTicker *time.Ticker
// NewLocalStorage returns a new LocalStorage instance.
func NewLocalStorage() *LocalStorage {
return &LocalStorage{}
}
// Setup configures this storage provider.
func (s *LocalStorage) Setup() error {
// NOTE: This cleanup timer will have to be disabled to support recordings in the future
// as all HLS segments have to be publicly available on disk to keep a recording of them.
_onlineCleanupTicker = time.NewTicker(1 * time.Minute)
s.onlineCleanupTicker = time.NewTicker(1 * time.Minute)
go func() {
for range _onlineCleanupTicker.C {
for range s.onlineCleanupTicker.C {
transcoder.CleanupOldContent(config.HLSStoragePath)
}
}()