Fail task if no peer left to try

This commit is contained in:
shortcutme 2019-12-21 02:57:53 +01:00
parent 8bf17d3a69
commit 62d4edadf6
No known key found for this signature in database
GPG Key ID: 5B63BAE6CB9613AE
1 changed files with 3 additions and 0 deletions

View File

@ -539,6 +539,9 @@ class WorkerManager(object):
self.tasks.updateItem(task, "workers_num", task["workers_num"] - 1)
else:
task["workers_num"] -= 1
if len(task["failed"]) >= len(self.workers):
fail_reason = "Too many fails: %s (workers: %s)" % (len(task["failed"]), len(self.workers))
self.failTask(task, reason=fail_reason)
# Wait for other tasks
def checkComplete(self):