aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2023-12-06 15:22:23 +0000
committerChristopher Baines <mail@cbaines.net>2023-12-06 15:42:45 +0000
commitfedc052e90e68b522f4912088673ebc53517452a (patch)
treee31b2099299c097c14a5adcbde5186b5f6ab369f
parent2439da4b2367e817c3de4705c4bebe8d3c04e50f (diff)
downloadbuild-coordinator-fedc052e90e68b522f4912088673ebc53517452a.tar
build-coordinator-fedc052e90e68b522f4912088673ebc53517452a.tar.gz
Avoid some database queries when running hooks
-rw-r--r--guix-build-coordinator/coordinator.scm22
1 files changed, 7 insertions, 15 deletions
diff --git a/guix-build-coordinator/coordinator.scm b/guix-build-coordinator/coordinator.scm
index cece029..2055c19 100644
--- a/guix-build-coordinator/coordinator.scm
+++ b/guix-build-coordinator/coordinator.scm
@@ -1199,25 +1199,17 @@
(let* ((in-progress-ids
(map car running-jobs))
(potential-jobs
- (map
- (match-lambda
- ((id _ _) (list id)))
- (datastore-list-unprocessed-hook-events
- datastore
- event-name
- (+ 1 (length in-progress-ids))))))
+ (datastore-list-unprocessed-hook-events
+ datastore
+ event-name
+ (+ 1 (length in-progress-ids)))))
(find
(match-lambda
- ((id)
+ ((id rest ...)
(not (member id in-progress-ids))))
potential-jobs)))
- (lambda (id)
- (match (datastore-find-unprocessed-hook-event
- datastore
- id)
- (#f #f) ; already processed
- ((event arguments)
- (process-event id event arguments handler))))
+ (lambda (id event arguments)
+ (process-event id event arguments handler))
#:name (symbol->string event-name))))
job-available))