aboutsummaryrefslogtreecommitdiff
path: root/guix-build-coordinator/datastore
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2021-11-16 21:54:18 +0000
committerChristopher Baines <mail@cbaines.net>2021-11-16 21:54:18 +0000
commit6ac3aaa08c9412abd36542e123830326beff1baf (patch)
tree1811c82ac0ef4fd28c1f90419d96b99f415c25fe /guix-build-coordinator/datastore
parent5b2fc03d84157172088e34107efebe4ec7ec017c (diff)
downloadbuild-coordinator-6ac3aaa08c9412abd36542e123830326beff1baf.tar
build-coordinator-6ac3aaa08c9412abd36542e123830326beff1baf.tar.gz
Track delays for a couple of sqlite datastore operations
Diffstat (limited to 'guix-build-coordinator/datastore')
-rw-r--r--guix-build-coordinator/datastore/sqlite.scm11
1 files changed, 9 insertions, 2 deletions
diff --git a/guix-build-coordinator/datastore/sqlite.scm b/guix-build-coordinator/datastore/sqlite.scm
index 94a3154..061f05a 100644
--- a/guix-build-coordinator/datastore/sqlite.scm
+++ b/guix-build-coordinator/datastore/sqlite.scm
@@ -361,6 +361,13 @@ PRAGMA optimize;")))))
result))
(thunk)))
+(define (call-with-worker-thread/delay-logging channel proc)
+ (call-with-worker-thread channel
+ proc
+ #:duration-logger
+ (lambda (duration)
+ (log-delay proc duration))))
+
(define %current-transaction-proc
(make-parameter #f))
@@ -2352,7 +2359,7 @@ VALUES (:event, :arguments)"
(define-method (datastore-count-unprocessed-hook-events
(datastore <sqlite-datastore>))
- (call-with-worker-thread
+ (call-with-worker-thread/delay-logging
(slot-ref datastore 'worker-reader-thread-channel)
(lambda (db)
(let ((statement
@@ -2513,7 +2520,7 @@ INSERT INTO build_allocation_plan (build_id, agent_id, ordering) VALUES "
(define-method (datastore-count-allocated-builds
(datastore <sqlite-datastore>))
- (call-with-worker-thread
+ (call-with-worker-thread/delay-logging
(slot-ref datastore 'worker-reader-thread-channel)
(lambda (db)
(let ((statement