aboutsummaryrefslogtreecommitdiff
path: root/nar-herder/storage.scm
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2022-05-05 13:24:00 +0100
committerChristopher Baines <mail@cbaines.net>2022-05-05 13:36:11 +0100
commitc369d7292e82f85e6eb6157331267fa424703900 (patch)
tree0ceb7c23c31578ab71dc1905296919d014a03596 /nar-herder/storage.scm
parent89f1a2329c583e4da08ddf104fedc69e72a33d32 (diff)
downloadnar-herder-c369d7292e82f85e6eb6157331267fa424703900.tar
nar-herder-c369d7292e82f85e6eb6157331267fa424703900.tar.gz
Skip mirroring files if downloading them fails
Until the next pass.
Diffstat (limited to 'nar-herder/storage.scm')
-rw-r--r--nar-herder/storage.scm25
1 files changed, 18 insertions, 7 deletions
diff --git a/nar-herder/storage.scm b/nar-herder/storage.scm
index c18be11..fab8966 100644
--- a/nar-herder/storage.scm
+++ b/nar-herder/storage.scm
@@ -336,13 +336,24 @@
(if (or no-storage-limit?
(< (+ storage-size file-bytes)
storage-limit))
- (begin
- (retry-on-error
- (lambda ()
- (fetch-file (assq-ref file 'url)))
- #:times 3
- #:delay 5)
- (loop (+ storage-size file-bytes)
+ (let ((success?
+ (with-exception-handler
+ (lambda (exn)
+ (log-msg 'ERROR "failed to fetch "
+ (assq-ref file 'url)
+ ": " exn)
+ #f)
+ (lambda ()
+ (retry-on-error
+ (lambda ()
+ (fetch-file (assq-ref file 'url)))
+ #:times 3
+ #:delay 5)
+ #t)
+ #:unwind? #t)))
+ (loop (if success?
+ (+ storage-size file-bytes)
+ storage-size)
(cdr missing-nar-files)))
;; This file won't fit, so try the next one
(loop storage-size