diff options
author | Christopher Baines <mail@cbaines.net> | 2021-11-26 22:43:44 +0000 |
---|---|---|
committer | Christopher Baines <mail@cbaines.net> | 2021-11-26 22:43:44 +0000 |
commit | 6ea187c375ed1d8879a63794416a79dcc1e4bdb4 (patch) | |
tree | 2b9e2594f16651c8e16e9632fafde55ff7619adb | |
parent | b632eb56a6f842c977189fb8f4da5b5929e6cdf2 (diff) | |
download | build-coordinator-6ea187c375ed1d8879a63794416a79dcc1e4bdb4.tar build-coordinator-6ea187c375ed1d8879a63794416a79dcc1e4bdb4.tar.gz |
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.
-rw-r--r-- | guix-build-coordinator/utils/fibers.scm | 17 |
1 files changed, 11 insertions, 6 deletions
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) |