aboutsummaryrefslogtreecommitdiff
path: root/guix-data-service
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2023-11-16 11:30:23 +0000
committerChristopher Baines <mail@cbaines.net>2023-11-16 11:30:23 +0000
commitde211ef5eafecba49a34eae7e6da6db78f198bf8 (patch)
tree865f5cdf61cbc8d42fd16c93bac719877c0fa670 /guix-data-service
parent37a07c2d6e8285877ad0440a7e4ae286b7b65177 (diff)
downloaddata-service-de211ef5eafecba49a34eae7e6da6db78f198bf8.tar
data-service-de211ef5eafecba49a34eae7e6da6db78f198bf8.tar.gz
Set the names of more threads
To help with debugging.
Diffstat (limited to 'guix-data-service')
-rw-r--r--guix-data-service/poll-git-repository.scm9
-rw-r--r--guix-data-service/web/server.scm19
2 files changed, 28 insertions, 0 deletions
diff --git a/guix-data-service/poll-git-repository.scm b/guix-data-service/poll-git-repository.scm
index e059343..124c559 100644
--- a/guix-data-service/poll-git-repository.scm
+++ b/guix-data-service/poll-git-repository.scm
@@ -25,6 +25,8 @@
#:use-module (git)
#:use-module (guix git)
#:use-module (guix channels)
+ #:use-module ((guix build syscalls)
+ #:select (set-thread-name))
#:use-module (guix-data-service database)
#:use-module (guix-data-service model git-repository)
#:use-module (guix-data-service model git-branch)
@@ -35,6 +37,13 @@
(define (start-thread-to-poll-git-repository git-repository-id)
(call-with-new-thread
(lambda ()
+ (catch 'system-error
+ (lambda ()
+ (set-thread-name
+ (simple-format #f "poll git ~A"
+ git-repository-id)))
+ (const #t))
+
(libgit2-init!)
(honor-system-x509-certificates!)
diff --git a/guix-data-service/web/server.scm b/guix-data-service/web/server.scm
index 6b855cc..7acfb2b 100644
--- a/guix-data-service/web/server.scm
+++ b/guix-data-service/web/server.scm
@@ -26,7 +26,10 @@
#:use-module (system repl error-handling)
#:use-module (ice-9 atomic)
#:use-module (fibers)
+ #:use-module (fibers scheduler)
#:use-module (fibers conditions)
+ #:use-module ((guix build syscalls)
+ #:select (set-thread-name))
#:use-module (prometheus)
#:use-module (guix-data-service utils)
#:use-module (guix-data-service database)
@@ -75,6 +78,22 @@
(lambda ()
(run-fibers
(lambda ()
+ (let* ((current (current-scheduler))
+ (schedulers
+ (cons current (scheduler-remote-peers current))))
+ (for-each
+ (lambda (i sched)
+ (spawn-fiber
+ (lambda ()
+ (catch 'system-error
+ (lambda ()
+ (set-thread-name
+ (string-append "fibers " (number->string i))))
+ (const #t)))
+ sched))
+ (iota (length schedulers))
+ schedulers))
+
(parameterize
((connection-pool
(make-resource-pool