diff options
author | Christopher Baines <mail@cbaines.net> | 2021-11-22 22:50:08 +0000 |
---|---|---|
committer | Christopher Baines <mail@cbaines.net> | 2021-11-22 22:50:08 +0000 |
commit | c9c55c0a16c0d72ad11389baf722ce90644c45d7 (patch) | |
tree | d7b95da1cc63d9d4b7f160094331a395cae5f285 /guix-build-coordinator/agent-messaging | |
parent | 77af94dec8ff792a35c6e5757e24b348babdf7b6 (diff) | |
download | build-coordinator-c9c55c0a16c0d72ad11389baf722ce90644c45d7.tar build-coordinator-c9c55c0a16c0d72ad11389baf722ce90644c45d7.tar.gz |
Delete existing files when processing upload requests
I think this will help when handling new requests after failed ones.
Diffstat (limited to 'guix-build-coordinator/agent-messaging')
-rw-r--r-- | guix-build-coordinator/agent-messaging/http/server.scm | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/guix-build-coordinator/agent-messaging/http/server.scm b/guix-build-coordinator/agent-messaging/http/server.scm index 107c9e7..2bc9dbf 100644 --- a/guix-build-coordinator/agent-messaging/http/server.scm +++ b/guix-build-coordinator/agent-messaging/http/server.scm @@ -501,8 +501,12 @@ port. Also, the port used can be changed by passing the --port option.\n" (tmp-output-file-name (string-append output-file-name ".tmp"))) (mkdir-p (dirname output-file-name)) + + (when (file-exists? output-file-name) + (delete-file output-file-name)) (when (file-exists? tmp-output-file-name) (delete-file tmp-output-file-name)) + (let ((hash (if (bytevector? body) (begin @@ -637,6 +641,12 @@ port. Also, the port used can be changed by passing the --port option.\n" (build-output-file-location datastore uuid output-name)) (tmp-output-file-name (string-append output-file-name ".tmp"))) + + ;; If the output file exists, delete it, as it's being uploaded + ;; again + (when (file-exists? output-file-name) + (delete-file output-file-name)) + (let ((hash (if (bytevector? body) (let ((output-port (open-file tmp-output-file-name "a"))) |