Fix WaitGroup deadlock

This commit is contained in:
Richard Patel 2019-02-03 17:12:45 +01:00
parent dbd787aa81
commit 771d49f2dd
No known key found for this signature in database
GPG Key ID: C268B2BBDA2ABECB
2 changed files with 1 additions and 3 deletions

View File

@ -30,8 +30,6 @@ func LoadResumeTasks(inRemotes chan<- *OD) {
} }
for _, remote := range resumed { for _, remote := range resumed {
// TODO Cleanup globalWait management
globalWait.Add(1)
inRemotes <- remote inRemotes <- remote
} }
} }

View File

@ -66,6 +66,7 @@ func scheduleNewTask(c context.Context, remote *OD) bool {
}) })
// Upload result when ready // Upload result when ready
globalWait.Add(1)
go remote.Watch(results) go remote.Watch(results)
// Sleep if max number of tasks are active // Sleep if max number of tasks are active
@ -83,7 +84,6 @@ func ScheduleTask(remotes chan<- *OD, t *Task, u *fasturl.URL) {
return return
} }
globalWait.Add(1)
now := time.Now() now := time.Now()
od := &OD { od := &OD {
Task: *t, Task: *t,