From e0f6f9ed4a9ba128657a379a855769f8bbf3abdb Mon Sep 17 00:00:00 2001 From: Christopher Baines Date: Tue, 25 Apr 2023 16:05:41 +0100 Subject: Support a duration logger in the worker thread channel --- guix-build-coordinator/utils/fibers.scm | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'guix-build-coordinator/utils') 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) -- cgit v1.2.3