From c78edaa0ffa28bb360663f172e98540b7978e9b2 Mon Sep 17 00:00:00 2001 From: Keuin Date: Wed, 7 Sep 2022 10:46:33 +0800 Subject: Handle error correctly when copying live stream. --- recording/runner.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'recording') diff --git a/recording/runner.go b/recording/runner.go index cee4325..a4693fb 100644 --- a/recording/runner.go +++ b/recording/runner.go @@ -85,7 +85,7 @@ func doTask(ctx context.Context, task *TaskConfig) error { for !cancelled { cancelled = record(recorderCtx, bi, task) } - logger.Printf("Task is cancelled. (room %v)\n", task.RoomId) + logger.Printf("Task is cancelled. Stop recording. (room %v)\n", task.RoomId) }() lastStatusIsLiving = true case WatcherLiveStop: @@ -159,7 +159,11 @@ func record( logger.Printf("Recording live stream to file \"%v\"...", filePath) err = bi.CopyLiveStream(ctx, task.RoomId, streamSource, file) - cancelled = false + cancelled = err == nil + if !cancelled { + // real error happens + logger.Printf("Error when copying live stream: %v\n", err) + } return } -- cgit v1.2.3