summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--recording/runner.go3
-rw-r--r--recording/task.go8
2 files changed, 7 insertions, 4 deletions
diff --git a/recording/runner.go b/recording/runner.go
index 7bf3790..ca4fe48 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 = StRunning
+ t.status = StWaiting
loop:
for {
err := tryRunTask(t)
@@ -171,6 +171,7 @@ func tryRunTask(t *RunningTask) error {
case nil:
// live is started, start recording
// (now the watcher should have stopped)
+ t.status = StRecording
return func() error {
var err error
run := true
diff --git a/recording/task.go b/recording/task.go
index 43b6678..d1f9c79 100644
--- a/recording/task.go
+++ b/recording/task.go
@@ -18,14 +18,16 @@ type TaskStatus int
const (
StNotStarted TaskStatus = iota
- StRunning
+ StWaiting
+ StRecording
StRestarting
StStopped
)
var taskStatusStrings = map[TaskStatus]string{
StNotStarted: "ready",
- StRunning: "running",
+ StWaiting: "waiting",
+ StRecording: "recording",
StRestarting: "restarting",
StStopped: "stopped",
}
@@ -94,7 +96,7 @@ func (t *RunningTask) StartTask() error {
t.runTaskWithAutoRestart()
}()
return nil
- case StRunning:
+ case StWaiting, StRecording:
return ErrTaskIsAlreadyStarted
case StRestarting:
return ErrTaskIsAlreadyStarted