summaryrefslogtreecommitdiff
path: root/recording/runner.go
diff options
context:
space:
mode:
authorKeuin <[email protected]>2023-07-29 21:27:47 +0800
committerKeuin <[email protected]>2023-07-29 21:27:47 +0800
commit03d9784bf682b05e3c4a46eb6cd32f4319e8636b (patch)
tree5a0f8052804304a2088ff3c57cd0b9bfccf34902 /recording/runner.go
parent2f0ef363eabce940314dc33f5966335642722fa2 (diff)
Make status field concurrent safe
Diffstat (limited to 'recording/runner.go')
-rw-r--r--recording/runner.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/recording/runner.go b/recording/runner.go
index ca4fe48..9671029 100644
--- a/recording/runner.go
+++ b/recording/runner.go
@@ -42,7 +42,7 @@ var errLiveEnded = errs.NewError(errs.LiveEnded)
// During the process, its status may change.
// Note: this method is blocking.
func (t *RunningTask) runTaskWithAutoRestart() {
- t.status = StWaiting
+ t.setStatus(StWaiting)
loop:
for {
err := tryRunTask(t)
@@ -56,7 +56,7 @@ loop:
if !errors.Is(err, errLiveEnded) {
t.logger.Error("Temporary error: %v", err)
}
- t.status = StRestarting
+ t.setStatus(StRestarting)
default:
t.logger.Error("Cannot recover from error: %v", err)
break loop
@@ -171,7 +171,7 @@ func tryRunTask(t *RunningTask) error {
case nil:
// live is started, start recording
// (now the watcher should have stopped)
- t.status = StRecording
+ t.setStatus(StRecording)
return func() error {
var err error
run := true