From f7095fe34d135d2b01fd74a2f30e3eb971c52adb 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..6d136b3fa4 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(name, b, nil) + glog.V(common.VERBOSE).Infof("Saving json playlist name=%s size=%d bytes took=%s", name, + len(b), time.Since(now)) + }(mgr.jsonList.name, b) if mgr.jsonList.DurationMs > 60*60*1000 { // 1 hour mgr.jsonList = NewJSONPlaylist() }