Set the names of more threads

To help with debugging.
This commit is contained in:
Christopher Baines 2023-11-16 11:30:23 +00:00
parent 37a07c2d6e
commit de211ef5ea
2 changed files with 28 additions and 0 deletions

View file

@ -25,6 +25,8 @@
#:use-module (git) #:use-module (git)
#:use-module (guix git) #:use-module (guix git)
#:use-module (guix channels) #:use-module (guix channels)
#:use-module ((guix build syscalls)
#:select (set-thread-name))
#:use-module (guix-data-service database) #:use-module (guix-data-service database)
#:use-module (guix-data-service model git-repository) #:use-module (guix-data-service model git-repository)
#:use-module (guix-data-service model git-branch) #:use-module (guix-data-service model git-branch)
@ -35,6 +37,13 @@
(define (start-thread-to-poll-git-repository git-repository-id) (define (start-thread-to-poll-git-repository git-repository-id)
(call-with-new-thread (call-with-new-thread
(lambda () (lambda ()
(catch 'system-error
(lambda ()
(set-thread-name
(simple-format #f "poll git ~A"
git-repository-id)))
(const #t))
(libgit2-init!) (libgit2-init!)
(honor-system-x509-certificates!) (honor-system-x509-certificates!)

View file

@ -26,7 +26,10 @@
#:use-module (system repl error-handling) #:use-module (system repl error-handling)
#:use-module (ice-9 atomic) #:use-module (ice-9 atomic)
#:use-module (fibers) #:use-module (fibers)
#:use-module (fibers scheduler)
#:use-module (fibers conditions) #:use-module (fibers conditions)
#:use-module ((guix build syscalls)
#:select (set-thread-name))
#:use-module (prometheus) #:use-module (prometheus)
#:use-module (guix-data-service utils) #:use-module (guix-data-service utils)
#:use-module (guix-data-service database) #:use-module (guix-data-service database)
@ -75,6 +78,22 @@
(lambda () (lambda ()
(run-fibers (run-fibers
(lambda () (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 (parameterize
((connection-pool ((connection-pool
(make-resource-pool (make-resource-pool