diff options
author | Christopher Baines <mail@cbaines.net> | 2023-04-25 16:05:41 +0100 |
---|---|---|
committer | Christopher Baines <mail@cbaines.net> | 2023-04-25 16:06:02 +0100 |
commit | e0f6f9ed4a9ba128657a379a855769f8bbf3abdb (patch) | |
tree | abcfb0e2fc5c2a9f7b5badf4433e4a65891025a2 | |
parent | 6a4e827f304178d3d20c2037b4f1bf62e969ddce (diff) | |
download | build-coordinator-e0f6f9ed4a9ba128657a379a855769f8bbf3abdb.tar build-coordinator-e0f6f9ed4a9ba128657a379a855769f8bbf3abdb.tar.gz |
Support a duration logger in the worker thread channel
-rw-r--r-- | guix-build-coordinator/utils/fibers.scm | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/guix-build-coordinator/utils/fibers.scm b/guix-build-coordinator/utils/fibers.scm index 99ca27f..921da8d 100644 --- a/guix-build-coordinator/utils/fibers.scm +++ b/guix-build-coordinator/utils/fibers.scm @@ -20,6 +20,7 @@ (define* (make-worker-thread-channel initializer #:key (parallelism 1) (delay-logger (lambda _ #f)) + (duration-logger (const #f)) destructor lifetime (log-exception? (const #t)) @@ -77,8 +78,14 @@ arguments of the worker thread procedure." response) (match response - (('worker-thread-error rest ...) #t) - (_ #f)))))))) + (('worker-thread-error duration _) + (when duration-logger + (duration-logger duration proc)) + #t) + ((duration . _) + (when duration-logger + (duration-logger duration proc)) + #f)))))))) (unless (and expire-on-exception? exception?) (if (number? current-lifetime) |