diff options
author | Keuin <[email protected]> | 2022-09-12 03:39:49 +0800 |
---|---|---|
committer | Keuin <[email protected]> | 2022-09-12 03:39:49 +0800 |
commit | 25fc31b21eae2ae117180b72363f240d51008bee (patch) | |
tree | 12a6efb75e8c2d8c6d854b57134a72d8eb832a7a /main.go | |
parent | dd34e58db1ea07e5bb3598eb57ae064e852957bf (diff) |
Bugfix: occasionally the program won't start because of a racing condition.v0.2.1
Diffstat (limited to 'main.go')
-rw-r--r-- | main.go | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -144,7 +144,7 @@ func main() { tasks[i] = recording.NewRunningTask( taskConfigs[i], ctxTasks, - func() { wg.Add(1) }, + func() {}, func() { wg.Done() }, logging.NewWrappedLogger(logger, fmt.Sprintf("room %v", task.RoomId)), ) @@ -155,9 +155,11 @@ func main() { logger.Printf("Starting tasks...") for i := range tasks { + wg.Add(1) err := tasks[i].StartTask() if err != nil { logger.Printf("Cannot start task %v (room %v): %v. Skip.", i, tasks[i].RoomId, err) + wg.Done() } } |