aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2024-04-16 12:17:42 +0100
committerChristopher Baines <mail@cbaines.net>2024-04-16 12:17:42 +0100
commit26c29bd09bb13578d0efed97b0e9303c26ac5e09 (patch)
tree0b76e7b65729c3e0ebf009010da366ad849b86b5
parent68ba0efbd8214edafb6d5d1891acab05f2cf898c (diff)
downloadnar-herder-26c29bd09bb13578d0efed97b0e9303c26ac5e09.tar
nar-herder-26c29bd09bb13578d0efed97b0e9303c26ac5e09.tar.gz
Add exception handling to the addition processing channel
-rw-r--r--nar-herder/server.scm46
1 files changed, 26 insertions, 20 deletions
diff --git a/nar-herder/server.scm b/nar-herder/server.scm
index 2b941b9..fecf166 100644
--- a/nar-herder/server.scm
+++ b/nar-herder/server.scm
@@ -810,26 +810,32 @@
(spawn-fiber
(lambda ()
(while #t
- (match (get-message addition-channel)
- (('addition file)
- (when mirror-channel
- (put-message mirror-channel
- `(fetch ,file)))
- (when removal-channel
- (spawn-fiber
- (lambda ()
- (sleep 60)
- (removal-channel-remove-nar-from-storage removal-channel
- file)
- (sleep (* 5 60))
- (removal-channel-remove-nar-from-storage removal-channel
- file)
- (sleep (* 15 60))
- (removal-channel-remove-nar-from-storage removal-channel
- file)
- (sleep 3600)
- (removal-channel-remove-nar-from-storage removal-channel
- file)))))))))
+ (with-exception-handler
+ (lambda (exn)
+ (log-msg 'ERROR "exception processing addition-channel: "
+ exn))
+ (lambda ()
+ (match (get-message addition-channel)
+ (('addition file)
+ (when mirror-channel
+ (put-message mirror-channel
+ `(fetch ,file)))
+ (when removal-channel
+ (spawn-fiber
+ (lambda ()
+ (sleep 60)
+ (removal-channel-remove-nar-from-storage removal-channel
+ file)
+ (sleep (* 5 60))
+ (removal-channel-remove-nar-from-storage removal-channel
+ file)
+ (sleep (* 15 60))
+ (removal-channel-remove-nar-from-storage removal-channel
+ file)
+ (sleep 3600)
+ (removal-channel-remove-nar-from-storage removal-channel
+ file)))))))
+ #:unwind? #t))))
(start-recent-change-listener-fiber
database