aboutsummaryrefslogtreecommitdiff
path: root/guix-build-coordinator/agent-messaging/http.scm
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2020-05-08 15:36:51 +0100
committerChristopher Baines <mail@cbaines.net>2020-05-08 15:36:51 +0100
commitc595d561896b3aa29106fb18e45fd737ab0de702 (patch)
treec6b7d5be86c6f8b922c27638d4a297b845e676fc /guix-build-coordinator/agent-messaging/http.scm
parent628b7b78f6fd92d006c4db9d971dcad58df051b9 (diff)
downloadbuild-coordinator-c595d561896b3aa29106fb18e45fd737ab0de702.tar
build-coordinator-c595d561896b3aa29106fb18e45fd737ab0de702.tar.gz
Switch to a database table rather than a channel for hook events
The channel caused problems, as it would potentially block processing requests if the hook event couldn't be processed immediately. This approach should avoid that, as well as providing more reliability because the events are stored in the database.
Diffstat (limited to 'guix-build-coordinator/agent-messaging/http.scm')
-rw-r--r--guix-build-coordinator/agent-messaging/http.scm11
1 files changed, 3 insertions, 8 deletions
diff --git a/guix-build-coordinator/agent-messaging/http.scm b/guix-build-coordinator/agent-messaging/http.scm
index dacf254..103e962 100644
--- a/guix-build-coordinator/agent-messaging/http.scm
+++ b/guix-build-coordinator/agent-messaging/http.scm
@@ -80,9 +80,6 @@ if there was no request body."
(define trigger-build-allocation
(make-build-allocator-thread datastore))
- (define hook-channel
- (make-hook-channel datastore hooks))
-
(define chunked-request-channel
;; There are fibers issues when trying to read the chunked requests
(make-worker-thread-channel (const '())
@@ -92,6 +89,7 @@ if there was no request body."
(base-datastore-metrics-updater datastore
coordinator-metrics-registry))
+ (start-hook-processing-thread datastore hooks)
(trigger-build-allocation)
(call-with-error-handling
(lambda ()
@@ -110,7 +108,6 @@ if there was no request body."
secret-key-base
datastore
trigger-build-allocation
- hook-channel
chunked-request-channel
update-base-datastore-metrics!)))
#:host host
@@ -221,7 +218,6 @@ port. Also, the port used can be changed by passing the --port option.\n"
secret-key-base
datastore
trigger-build-allocation
- hook-channel
chunked-request-channel
update-base-datastore-metrics!)
(define (authenticated? uuid request)
@@ -289,8 +285,7 @@ port. Also, the port used can be changed by passing the --port option.\n"
(backtrace)
(raise-exception exn))
(lambda ()
- (handle-build-result datastore hook-channel
- agent-id-for-build uuid
+ (handle-build-result datastore agent-id-for-build uuid
(json-string->scm (utf8->string body)))
;; Trigger build allocation, as the result of this build
;; could change the allocation
@@ -307,7 +302,7 @@ port. Also, the port used can be changed by passing the --port option.\n"
(if (authenticated? agent-id-for-build request)
(begin
(handle-setup-failure-report
- datastore hook-channel
+ datastore
agent-id-for-build uuid
(json-string->scm (utf8->string body)))
;; Trigger build allocation, so that the allocator can handle