summaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
authorKeuin <[email protected]>2022-09-12 03:39:49 +0800
committerKeuin <[email protected]>2022-09-12 03:39:49 +0800
commit25fc31b21eae2ae117180b72363f240d51008bee (patch)
tree12a6efb75e8c2d8c6d854b57134a72d8eb832a7a /main.go
parentdd34e58db1ea07e5bb3598eb57ae064e852957bf (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.go4
1 files changed, 3 insertions, 1 deletions
diff --git a/main.go b/main.go
index bf3b10a..d6a433e 100644
--- a/main.go
+++ b/main.go
@@ -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()
}
}