mirror of
https://github.com/terorie/od-database-crawler.git
synced 2025-04-18 09:56:44 +00:00
Fix WaitGroup deadlock
This commit is contained in:
parent
dbd787aa81
commit
771d49f2dd
@ -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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user