mirror of
https://github.com/terorie/od-database-crawler.git
synced 2025-12-13 15:19:03 +00:00
Bugfix: Don't schedule new tasks during shutdown
This commit is contained in:
@@ -21,10 +21,15 @@ var totalQueued int64
|
|||||||
func Schedule(c context.Context, remotes <-chan *OD) {
|
func Schedule(c context.Context, remotes <-chan *OD) {
|
||||||
go Stats(c)
|
go Stats(c)
|
||||||
|
|
||||||
for remote := range remotes {
|
for {
|
||||||
|
select {
|
||||||
|
case remote := <-remotes:
|
||||||
if !scheduleNewTask(c, remote) {
|
if !scheduleNewTask(c, remote) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
case <-c.Done():
|
||||||
|
return
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user