summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--distbuild/worker_build_scheduler.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/distbuild/worker_build_scheduler.py b/distbuild/worker_build_scheduler.py
index ce2589d8..a62fa7f0 100644
--- a/distbuild/worker_build_scheduler.py
+++ b/distbuild/worker_build_scheduler.py
@@ -501,6 +501,14 @@ class WorkerConnection(distbuild.StateMachine):
msg = distbuild.message('exec-cancel', id=job.id)
self._jm.send(msg)
+ # NOTE: We need to set job's state to 'failed' as soon as possible.
+ # The exec-response message may take a while to arrive, and if we
+ # wait for that then it is possible that another build-request for
+ # the same artifact could be made, which would result in the build
+ # not being started since the cancelled job would still be 'running'.
+ # The new build will then fail when the exec-response for the old
+ # build finally arrives.
+ job.set_state('failed')
self.mainloop.queue_event(self, _BuildCancelled())
def _disconnected(self, event_source, event):