diff options
author | Christopher Baines <mail@cbaines.net> | 2020-04-27 20:18:49 +0100 |
---|---|---|
committer | Christopher Baines <mail@cbaines.net> | 2020-04-27 20:26:14 +0100 |
commit | c894a5ebdd9b8a0b37e7f140eac8421f3ec09089 (patch) | |
tree | 17df0b845eb9d74bd9e4b2590c21b1cc6ffae709 | |
parent | 6af6231b7423f6c7dfacfa5ba73d1be65ff5183d (diff) | |
download | build-coordinator-c894a5ebdd9b8a0b37e7f140eac8421f3ec09089.tar build-coordinator-c894a5ebdd9b8a0b37e7f140eac8421f3ec09089.tar.gz |
Guard against a build being processed twice
Or rather reported as finished twice, which could happen if the agent retries
the request, but it worked the first time. The database constraint will
prevent the request going through, but check here to provide a better error
message.
-rw-r--r-- | guix-build-coordinator/coordinator.scm | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/guix-build-coordinator/coordinator.scm b/guix-build-coordinator/coordinator.scm index 14fbd5d..628dc99 100644 --- a/guix-build-coordinator/coordinator.scm +++ b/guix-build-coordinator/coordinator.scm @@ -233,6 +233,11 @@ agent-id build-id result-json) (let* ((result (assoc-ref result-json "result")) (success? (string=? result "success"))) + (let ((build-details (datastore-find-build datastore build-id))) + (when (assq-ref build-details 'processed?) + (raise-exception + (make-exception-with-message "build already processed")))) + (when success? (unless (build-log-file-exists? build-id) (raise-exception |