Skip to content

Commit

Permalink
fix last status bug
Browse files Browse the repository at this point in the history
  • Loading branch information
jhazentia committed Dec 10, 2024
1 parent 6084141 commit fd30f6b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/scheduler/scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,13 +251,13 @@ def _finalize_task_result(self, task_result, started, finished, status, detail):
task_result.save()

with self.task_status_lock:
self.last_status = status
if status == "failure" and self.last_status == "failure":
self.consecutive_failures = self.consecutive_failures + 1
elif status == "failure":
self.consecutive_failures = 1
else:
self.consecutive_failures = 0
self.last_status = status
if self.consecutive_failures >= settings.MAX_FAILURES:
trigger_api_restart.send(sender=self.__class__)
# prevent more tasks from being run
Expand Down

0 comments on commit fd30f6b

Please sign in to comment.