From 28e2047d78c397faf30df2e1f2d7f4802921602f Mon Sep 17 00:00:00 2001 From: Ivan Tivonenko Date: Thu, 27 Aug 2020 14:18:31 +0300 Subject: [PATCH] Save JSON playlist to object storage in own goroutine Fixes #1609 --- core/playlistmanager.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/core/playlistmanager.go b/core/playlistmanager.go index adec94e5e7..8d2b173b59 100644 --- a/core/playlistmanager.go +++ b/core/playlistmanager.go @@ -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() }