From 159e2164f376b0ed582534a0880f4ae90fcdb896 Mon Sep 17 00:00:00 2001 From: Christopher Baines Date: Fri, 30 Jun 2023 19:11:35 +0100 Subject: Show progress for downloading the database dump --- scripts/nar-herder.in | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'scripts') diff --git a/scripts/nar-herder.in b/scripts/nar-herder.in index c4a4bd2..c20aab7 100644 --- a/scripts/nar-herder.in +++ b/scripts/nar-herder.in @@ -483,9 +483,21 @@ (when (not (= (response-code response) 200)) (error "unable to fetch database from mirror")) - (call-with-output-file (assq-ref opts 'database) - (lambda (output-port) - (dump-port body output-port))) + (let* ((reporter (progress-reporter/file + (uri->string database-uri) + (response-content-length response) + (current-error-port))) + (port + (progress-report-port + reporter + body + #:download-size (response-content-length response)))) + + (call-with-output-file (assq-ref opts 'database) + (lambda (output-port) + (dump-port port output-port))) + + (close-port port)) (simple-format (current-error-port) "finished downloading the database\n"))))) -- cgit v1.2.3