diff options
author | Keuin <[email protected]> | 2022-09-12 01:46:58 +0800 |
---|---|---|
committer | Keuin <[email protected]> | 2022-09-12 01:46:58 +0800 |
commit | 6bbb50f7a400767a8d2ff9b6982099b538203b83 (patch) | |
tree | aacc22cd506f3e3f6d9c2a18f0172b01d00eb52f | |
parent | 4fa50556d047c6909af45543c2440104f261b094 (diff) |
Bugfix: task won't restart if the live is closed normally.v0.1.1
-rw-r--r-- | recording/runner.go | 7 |
1 files changed, 7 insertions, 0 deletions
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 } } |