summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeuin <[email protected]>2022-09-12 01:46:58 +0800
committerKeuin <[email protected]>2022-09-12 01:46:58 +0800
commit6bbb50f7a400767a8d2ff9b6982099b538203b83 (patch)
treeaacc22cd506f3e3f6d9c2a18f0172b01d00eb52f
parent4fa50556d047c6909af45543c2440104f261b094 (diff)
Bugfix: task won't restart if the live is closed normally.v0.1.1
-rw-r--r--recording/runner.go7
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
}
}