aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2020-10-02 17:40:50 +0100
committerChristopher Baines <mail@cbaines.net>2020-10-02 17:40:50 +0100
commitb1c5392ce817d467730aa4c435e63e6ed7c81524 (patch)
treeb24ca8c250d7e6920fe07cd6e312232639f73676
parent46465ab437ab2a15e9d2a4f1ed9e8eca72eee9cb (diff)
downloadbuild-coordinator-b1c5392ce817d467730aa4c435e63e6ed7c81524.tar
build-coordinator-b1c5392ce817d467730aa4c435e63e6ed7c81524.tar.gz
Guard against Guix Data Service requests hanging
I don't know if this is happening, but the hooks are getting stuck, and this might be a cause.
-rw-r--r--guix-build-coordinator/guix-data-service.scm15
1 files changed, 10 insertions, 5 deletions
diff --git a/guix-build-coordinator/guix-data-service.scm b/guix-build-coordinator/guix-data-service.scm
index e67949c..c662c66 100644
--- a/guix-build-coordinator/guix-data-service.scm
+++ b/guix-build-coordinator/guix-data-service.scm
@@ -25,6 +25,7 @@
#:use-module (json)
#:use-module (web client)
#:use-module (web response)
+ #:use-module (guix-build-coordinator utils)
#:use-module (guix-build-coordinator datastore)
#:export (send-build-event-to-guix-data-service
@@ -41,11 +42,15 @@
(let*-values
(((response body)
- (http-post target-url
- #:body body
- ;; Guile doesn't treat JSON as text, so decode the
- ;; body manually
- #:decode-body? #f))
+ (with-timeout 30000 ; 30 seconds
+ (raise-exception
+ (make-exception-with-message
+ "timeout making guix-data-service request"))
+ (http-post target-url
+ #:body body
+ ;; Guile doesn't treat JSON as text, so decode the
+ ;; body manually
+ #:decode-body? #f)))
((code)
(response-code response)))
(unless (and (>= code 200)