aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2020-02-02 10:10:25 +0100
committerChristopher Baines <mail@cbaines.net>2020-02-02 10:10:25 +0100
commit956aa9ecb046f4dc1d8287f0db316b5b4baf4ad7 (patch)
treebcd3279330b157df9d6a8672e290caebd640fab0
parentf59354ed23a9c50e43b7aaaeaddb5365feda4e29 (diff)
downloaddata-service-956aa9ecb046f4dc1d8287f0db316b5b4baf4ad7.tar
data-service-956aa9ecb046f4dc1d8287f0db316b5b4baf4ad7.tar.gz
Log the time taken to acquire advisory session locks
-rw-r--r--guix-data-service/jobs/load-new-guix-revision.scm14
1 files changed, 13 insertions, 1 deletions
diff --git a/guix-data-service/jobs/load-new-guix-revision.scm b/guix-data-service/jobs/load-new-guix-revision.scm
index e4fc29e..cd02706 100644
--- a/guix-data-service/jobs/load-new-guix-revision.scm
+++ b/guix-data-service/jobs/load-new-guix-revision.scm
@@ -224,6 +224,18 @@ WHERE job_id = $1"
(simple-format #t "debug: Finished ~A, took ~A seconds\n"
action time-taken)))))
+(define (with-advisory-session-lock/log-time conn lock f)
+ (simple-format #t "debug: Acquiring advisory session lock: ~A\n" lock)
+ (let ((start-time (current-time)))
+ (with-advisory-session-lock
+ conn
+ lock
+ (lambda ()
+ (let ((time-taken (- (current-time) start-time)))
+ (simple-format #t "debug: Finished aquiring lock ~A, took ~A seconds\n"
+ lock time-taken))
+ (f)))))
+
(define (all-inferior-lint-warnings inf store)
(define locales
'("cs_CZ.utf8"
@@ -738,7 +750,7 @@ WHERE job_id = $1"
(lambda ()
;; Obtain a session level lock here, to avoid conflicts with
;; other jobs over the Git repository.
- (with-advisory-session-lock
+ (with-advisory-session-lock/log-time
conn
'channel->manifest-store-item
(lambda ()