Start cleaning up linter errors. (#358)

* Start cleaning up linter errors. For #357

* Fix unmarshalling NullTime values

* More linter fixes

* Remove commented code

* Move defer up

* Consolidate error check lines

* Move error check to make sure row iteration was successful

* Cleaner error check + do not recreate pipe if it exists

* Consolidate hashing to generate client id
This commit is contained in:
Gabe Kangas
2020-11-14 18:39:53 -08:00
committed by GitHub
parent c76b7229a5
commit 4d2066a76d
34 changed files with 248 additions and 143 deletions

View File

@@ -23,11 +23,8 @@ func (s *LocalStorage) Setup() error {
// as all HLS segments have to be publicly available on disk to keep a recording of them.
_onlineCleanupTicker = time.NewTicker(1 * time.Minute)
go func() {
for {
select {
case <-_onlineCleanupTicker.C:
ffmpeg.CleanupOldContent(config.PublicHLSStoragePath)
}
for range _onlineCleanupTicker.C {
ffmpeg.CleanupOldContent(config.PublicHLSStoragePath)
}
}()
return nil
@@ -35,7 +32,10 @@ func (s *LocalStorage) Setup() error {
// SegmentWritten is called when a single segment of video is written.
func (s *LocalStorage) SegmentWritten(localFilePath string) {
s.Save(localFilePath, 0)
_, err := s.Save(localFilePath, 0)
if err != nil {
log.Warnln(err)
}
}
// VariantPlaylistWritten is called when a variant hls playlist is written.
@@ -49,7 +49,10 @@ func (s *LocalStorage) VariantPlaylistWritten(localFilePath string) {
// MasterPlaylistWritten is called when the master hls playlist is written.
func (s *LocalStorage) MasterPlaylistWritten(localFilePath string) {
s.Save(localFilePath, 0)
_, err := s.Save(localFilePath, 0)
if err != nil {
log.Warnln(err)
}
}
// Save will save a local filepath using the storage provider.
@@ -63,7 +66,6 @@ func (s *LocalStorage) Save(filePath string, retryCount int) (string, error) {
newPath = filepath.Join(config.WebRoot, filePath)
}
utils.Copy(filePath, newPath)
return newPath, nil
err := utils.Copy(filePath, newPath)
return newPath, err
}