diff options
author | Christopher Baines <mail@cbaines.net> | 2020-05-09 19:05:00 +0100 |
---|---|---|
committer | Christopher Baines <mail@cbaines.net> | 2020-05-09 19:05:00 +0100 |
commit | 7981e52681231c06a4de4cbc8639fa251e13f9da (patch) | |
tree | dbfe9900d0712ab46a966f2f21c86739bfec3c95 | |
parent | 7c2be71f5537f1ed30007ebee76d31902a16015a (diff) | |
download | build-coordinator-7981e52681231c06a4de4cbc8639fa251e13f9da.tar build-coordinator-7981e52681231c06a4de4cbc8639fa251e13f9da.tar.gz |
Improve the output receiving informational messages
-rw-r--r-- | guix-build-coordinator/agent-messaging/http.scm | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/guix-build-coordinator/agent-messaging/http.scm b/guix-build-coordinator/agent-messaging/http.scm index 1af7f3c..9e60b4a 100644 --- a/guix-build-coordinator/agent-messaging/http.scm +++ b/guix-build-coordinator/agent-messaging/http.scm @@ -349,7 +349,8 @@ port. Also, the port used can be changed by passing the --port option.\n" (lambda (output-port) (let ((start-time (current-time time-utc))) (let loop ((line (get-line body)) - (base64-characters-read 0)) + (base64-characters-read 0) + (last-progress-update-characters-read 0)) (if (eof-object? line) (let* ((end-time (current-time time-utc)) (elapsed (time-difference end-time @@ -362,18 +363,33 @@ port. Also, the port used can be changed by passing the --port option.\n" (display (simple-format #f - "receiving ~A\n took ~A seconds\n bytes transfered: ~A\n speed (b/s): ~A\n" - output-file-name + "receiving ~A\n took ~A seconds\n data transfered: ~AMB\n speed (MB/s): ~A\n" + (basename output-file-name) seconds-elapsed - bytes-transfered - (/ bytes-transfered seconds-elapsed)))) + (rationalize (exact->inexact (/ bytes-transfered 1000000)) + 0.1) + (rationalize (/ (/ bytes-transfered 1000000) seconds-elapsed) + 0.1)))) (begin (base64-decode line base64-alphabet output-port) (loop (get-line body) (+ base64-characters-read - (string-length line))))))))) + (string-length line)) + (if (> (- base64-characters-read + last-progress-update-characters-read) + 66666666) ; ~50MB in base64 characters + (begin + (display + (simple-format + #f "receiving ~A\n ~AMB read so far...\n" + (basename output-file-name) + (rationalize (exact->inexact (/ (* 3 (/ base64-characters-read 4)) + 1000000)) + 0.1))) + base64-characters-read) + last-progress-update-characters-read)))))))) #t)) (no-content) (render-json |