Skip to content

Commit

Permalink
Save JSON playlist to object storage in own goroutine
Browse files Browse the repository at this point in the history
Fixes #1609
  • Loading branch information
darkdarkdragon committed Aug 27, 2020
1 parent b159973 commit 4c838e6
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions core/playlistmanager.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,10 +217,12 @@ func (mgr *BasicPlaylistManager) FlushRecord() {
glog.Error("Error encoding playlist: ", err)
return
}
now := time.Now()
mgr.recordSession.SaveData(mgr.jsonList.name, b, nil)
glog.V(common.VERBOSE).Infof("Saving json playlist name=%s size=%d bytes took=%s", mgr.jsonList.name,
len(b), time.Since(now))
go func(name string, data []byte) {
now := time.Now()
mgr.recordSession.SaveData(mgr.jsonList.name, b, nil)
glog.V(common.VERBOSE).Infof("Saving json playlist name=%s size=%d bytes took=%s", mgr.jsonList.name,
len(b), time.Since(now))
}(mgr.jsonList.name, b)
if mgr.jsonList.DurationMs > 60*60*1000 { // 1 hour
mgr.jsonList = NewJSONPlaylist()
}
Expand Down

0 comments on commit 4c838e6

Please sign in to comment.