Bugfix: Don't schedule new tasks during shutdown

This commit is contained in:
Richard Patel 2019-02-03 17:02:44 +01:00
parent 885af5bb3b
commit cea6c1658b
No known key found for this signature in database
GPG Key ID: C268B2BBDA2ABECB

View File

@ -21,8 +21,13 @@ var totalQueued int64
func Schedule(c context.Context, remotes <-chan *OD) {
go Stats(c)
for remote := range remotes {
if !scheduleNewTask(c, remote) {
for {
select {
case remote := <-remotes:
if !scheduleNewTask(c, remote) {
return
}
case <-c.Done():
return
}
}