From 6ea187c375ed1d8879a63794416a79dcc1e4bdb4 Mon Sep 17 00:00:00 2001 From: Christopher Baines Date: Fri, 26 Nov 2021 22:43:44 +0000 Subject: Allow disabling the logging of exceptions in worker threads As some exceptions can be expected, like chunked responses being incomplete, so allow reducing the unnecessary output. --- guix-build-coordinator/utils/fibers.scm | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'guix-build-coordinator/utils') diff --git a/guix-build-coordinator/utils/fibers.scm b/guix-build-coordinator/utils/fibers.scm index 47ae072..8aef7cc 100644 --- a/guix-build-coordinator/utils/fibers.scm +++ b/guix-build-coordinator/utils/fibers.scm @@ -18,7 +18,8 @@ #:key (parallelism 1) (delay-logger (lambda _ #f)) destructor - lifetime) + lifetime + (log-exception? (const #t))) "Return a channel used to offload work to a dedicated thread. ARGS are the arguments of the worker thread procedure." (parameterize (((@@ (fibers internal) current-fiber) #f)) @@ -58,11 +59,15 @@ arguments of the worker thread procedure." start-time) internal-time-units-per-second) vals)))) - (lambda (key . args) - (simple-format - (current-error-port) - "worker-thread: exception: ~A ~A\n" key args) - (backtrace)))) + (lambda args + (when (match args + (('%exception exn) + (log-exception? exn)) + (_ #t)) + (simple-format + (current-error-port) + "worker-thread: exception: ~A\n" args) + (backtrace))))) #:unwind? #t)))))) (if (number? current-lifetime) (unless (< current-lifetime 0) -- cgit v1.2.3