aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2024-10-16 11:00:24 +0100
committerChristopher Baines <mail@cbaines.net>2024-10-16 11:00:24 +0100
commit59d2b8aa23d0119a3c95e9d3b90fd6b36d1bde6a (patch)
tree4e1f0dacca2f91f031eee0922bc22528dfeb8c8a
parent1c608ffee23a662bcd1197c598e1f8dde00001d3 (diff)
downloadnar-herder-59d2b8aa23d0119a3c95e9d3b90fd6b36d1bde6a.tar
nar-herder-59d2b8aa23d0119a3c95e9d3b90fd6b36d1bde6a.tar.gz
Wrap more with call-with-cached-connectionHEADmaster
To close the connection in case of errors.
-rw-r--r--nar-herder/storage.scm31
1 files changed, 15 insertions, 16 deletions
diff --git a/nar-herder/storage.scm b/nar-herder/storage.scm
index 57f35fb..87e2ff1 100644
--- a/nar-herder/storage.scm
+++ b/nar-herder/storage.scm
@@ -424,22 +424,21 @@ When VERIFY-CERTIFICATE? is true, verify HTTPS server certificates."
(lambda ()
(retry-on-error
(lambda ()
- (call-with-values
- (lambda ()
- (call-with-cached-connection
- uri
- (lambda (port)
- (http-get uri
- #:port port
- #:decode-body? #f
- #:keep-alive? #t
- #:streaming? #t))))
- (lambda (response body)
- (and (= (response-code response)
- 200)
- (let ((json-body (json->scm body)))
- (eq? (assoc-ref json-body "stored")
- #t))))))
+ (call-with-cached-connection
+ uri
+ (lambda (port)
+ (let ((response
+ body
+ (http-get uri
+ #:port port
+ #:decode-body? #f
+ #:keep-alive? #t
+ #:streaming? #t)))
+ (and (= (response-code response)
+ 200)
+ (let ((json-body (json->scm body)))
+ (eq? (assoc-ref json-body "stored")
+ #t)))))))
#:times 3
#:delay 5))
#:timeout 30)))))