guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

02/03: SQUASHME rate-limited output for 'progress-reporter/trace'


From: Ludovic Courtès
Subject: 02/03: SQUASHME rate-limited output for 'progress-reporter/trace'
Date: Thu, 27 Sep 2018 12:33:39 -0400 (EDT)

civodul pushed a commit to branch wip-ui
in repository guix.

commit aa4b7cda9c265af89a0bbf6b750dc5334085a2b7
Author: Ludovic Courtès <address@hidden>
Date:   Thu Sep 27 18:17:57 2018 +0200

    SQUASHME rate-limited output for 'progress-reporter/trace'
    
    * guix/progress.scm: (%progress-interval): New variable.
    (progress-reporter/file): Use it.
---
 guix/progress.scm | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/guix/progress.scm b/guix/progress.scm
index 2761009..3b9ff40 100644
--- a/guix/progress.scm
+++ b/guix/progress.scm
@@ -223,6 +223,10 @@ throughput."
                  log-port)
         (force-output log-port))))
 
+(define %progress-interval
+  ;; Default interval between subsequent outputs for rate-limited displays.
+  (make-time time-monotonic 200000000 0))
+
 (define* (progress-reporter/file file size
                                  #:optional (log-port (current-output-port))
                                  #:key (abbreviation basename))
@@ -241,8 +245,7 @@ ABBREVIATION used to shorten FILE for display."
      (start render)
      ;; Report the progress every 300ms or longer.
      (report
-      (let ((rate-limited-render
-             (rate-limited render (make-time time-monotonic 300000000 0))))
+      (let ((rate-limited-render (rate-limited render %progress-interval)))
         (lambda (value)
           (set! transferred value)
           (rate-limited-render))))
@@ -299,8 +302,9 @@ progress reports, write \"build trace\" lines to be 
processed elsewhere."
             (display (format #f "@ download-started ~a ~a ~a~%"
                              file url (or size "-"))
                      log-port)))
-   (report report-progress)
+   (report (rate-limited report-progress %progress-interval))
    (stop (lambda ()
+           (report-progress size)
            (display (format #f "@ download-succeeded ~a ~a ~a~%"
                             file url
                             (or (and=> (stat file #f) stat:size)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]