From 6bbb50f7a400767a8d2ff9b6982099b538203b83 Mon Sep 17 00:00:00 2001 From: Keuin Date: Mon, 12 Sep 2022 01:46:58 +0800 Subject: Bugfix: task won't restart if the live is closed normally. --- recording/runner.go | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'recording/runner.go') diff --git a/recording/runner.go b/recording/runner.go index 2830ee7..039b760 100644 --- a/recording/runner.go +++ b/recording/runner.go @@ -12,6 +12,7 @@ import ( "fmt" "github.com/keuin/slbr/bilibili" "github.com/keuin/slbr/common" + "io" "os" "path" "time" @@ -113,8 +114,14 @@ func tryRunTask(t *RunningTask) error { t.logger.Info("Live is ended. Stop recording.") return bilibili.ErrRoomIsClosed } + if errors.Is(err2, io.EOF) { + t.logger.Warning("Live is stopped because of an EOF while reading. " + + "This may be caused by a broken connection or a closing live. Retrying...") + cancelled = false + } if err2 != nil { // some other unrecoverable error + t.logger.Error("Cannot recover from error: %v") return err2 } } -- cgit v1.2.3