Process queued build events in parallel
This commit is contained in:
parent
61780fe7ea
commit
f1e444babe
1 changed files with 17 additions and 11 deletions
|
|
@ -35,6 +35,7 @@
|
|||
#:use-module (knots)
|
||||
#:use-module (knots web-server)
|
||||
#:use-module (knots thread-pool)
|
||||
#:use-module (knots parallelism)
|
||||
#:use-module (knots resource-pool)
|
||||
#:use-module (prometheus)
|
||||
#:use-module (guix-data-service utils)
|
||||
|
|
@ -246,15 +247,17 @@ port. Also, the port used can be changed by passing the --port option.\n"
|
|||
exn)
|
||||
(raise-exception exn))
|
||||
(lambda ()
|
||||
(call-with-resource-from-pool (background-connection-pool)
|
||||
(lambda (conn)
|
||||
(let ((build-ids
|
||||
(select-background-processing-build-ids conn)))
|
||||
(unless (null? build-ids)
|
||||
(simple-format #t "processing ~A builds from the background queue\n"
|
||||
(length build-ids)))
|
||||
(for-each
|
||||
(lambda (build-id)
|
||||
(let ((build-ids
|
||||
(call-with-resource-from-pool (background-connection-pool)
|
||||
(lambda (conn)
|
||||
(select-background-processing-build-ids conn)))))
|
||||
(unless (null? build-ids)
|
||||
(simple-format #t "processing ~A builds from the background queue\n"
|
||||
(length build-ids)))
|
||||
(fibers-batch-for-each
|
||||
(lambda (build-id)
|
||||
(call-with-resource-from-pool (background-connection-pool)
|
||||
(lambda (conn)
|
||||
(let ((status (select-latest-build-status-by-build-id
|
||||
conn
|
||||
build-id)))
|
||||
|
|
@ -275,8 +278,11 @@ port. Also, the port used can be changed by passing the --port option.\n"
|
|||
(list build-id)))))
|
||||
(delete-background-processing-entries-for-build-ids
|
||||
conn
|
||||
(list build-id)))
|
||||
build-ids)))))))
|
||||
(list build-id)))))
|
||||
(assq-ref (resource-pool-stats (background-connection-pool)
|
||||
#:timeout #f)
|
||||
'resources)
|
||||
build-ids)))))
|
||||
#:unwind? #t))
|
||||
#:parallel? #t)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue