Fix sleeps

This commit is contained in:
Richard Patel
2019-02-03 16:34:29 +01:00
parent 25d0b0042c
commit 4ef4ab13a8
2 changed files with 8 additions and 9 deletions

View File

@@ -65,11 +65,8 @@ func scheduleNewTask(c context.Context, remote *OD) bool {
// Sleep if max number of tasks are active
for atomic.LoadInt32(&numActiveTasks) > config.Tasks {
select {
case <-c.Done():
return false
case <-time.After(time.Second):
return true
if !sleep(time.Second, c) {
break
}
}