diff options
author | Keuin <[email protected]> | 2023-07-29 21:20:12 +0800 |
---|---|---|
committer | Keuin <[email protected]> | 2023-07-29 21:20:12 +0800 |
commit | 110301a975e43739192577166d089e28c22ae266 (patch) | |
tree | e655e00876b0140aa9ad431824765cd1c8371899 /recording/task.go | |
parent | e72342b0027752dc93e57ebec99c4eb9a8aa8efe (diff) |
Add API server
Diffstat (limited to 'recording/task.go')
-rw-r--r-- | recording/task.go | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/recording/task.go b/recording/task.go index 26f3638..43b6678 100644 --- a/recording/task.go +++ b/recording/task.go @@ -10,6 +10,7 @@ import ( "fmt" "github.com/keuin/slbr/common/retry" "github.com/keuin/slbr/logging" + "sync/atomic" "time" ) @@ -51,7 +52,16 @@ type RunningTask struct { // hookStopped: called asynchronously when the task is stopped. This won't be called when restarting. hookStopped func() // logger: where to print logs - logger logging.Logger + logger logging.Logger + roomTitle atomic.Pointer[string] +} + +func (t *RunningTask) GetStatus() TaskStatus { + return t.status +} + +func (t *RunningTask) GetRoomTitle() *string { + return t.roomTitle.Load() } func NewRunningTask( @@ -60,8 +70,8 @@ func NewRunningTask( hookStarted func(), hookStopped func(), logger logging.Logger, -) RunningTask { - return RunningTask{ +) *RunningTask { + return &RunningTask{ TaskConfig: config, ctx: ctx, status: StNotStarted, |