guix-commits
[Top][All Lists]
Advanced

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

branch master updated: weather: Only show request statistics when reques


From: guix-commits
Subject: branch master updated: weather: Only show request statistics when requests were made.
Date: Wed, 17 Mar 2021 19:12:54 -0400

This is an automated email from the git hooks/post-receive script.

cbaines pushed a commit to branch master
in repository guix.

The following commit(s) were added to refs/heads/master by this push:
     new 806125e  weather: Only show request statistics when requests were made.
806125e is described below

commit 806125e52f1b94f8eff74daecc5306b5934bb616
Author: Christopher Baines <mail@cbaines.net>
AuthorDate: Wed Mar 17 23:10:22 2021 +0000

    weather: Only show request statistics when requests were made.
    
    This avoids the script crashing if all data is fetched from the cache.
    
    * guix/scripts/weather.scm (report-server-coverage): Only show request
    statistics when some requests have been made.
---
 guix/scripts/weather.scm | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/guix/scripts/weather.scm b/guix/scripts/weather.scm
index 3490524..5164fe0 100644
--- a/guix/scripts/weather.scm
+++ b/guix/scripts/weather.scm
@@ -212,10 +212,11 @@ Return the coverage ratio, an exact number between 0 and 
1."
                        total)))))
       (format #t (G_ "  ~,1h MiB on disk (uncompressed)~%")
               (/ (reduce + 0 (map narinfo-size narinfos)) MiB))
-      (format #t (G_ "  ~,3h seconds per request (~,1h seconds in total)~%")
-              (/ time requests-made 1.) time)
-      (format #t (G_ "  ~,1h requests per second~%")
-              (/ requests-made time 1.))
+      (when (> requests-made 0)
+        (format #t (G_ "  ~,3h seconds per request (~,1h seconds in total)~%")
+                (/ time requests-made 1.) time)
+        (format #t (G_ "  ~,1h requests per second~%")
+                (/ requests-made time 1.)))
 
       (guard (c ((http-get-error? c)
                  (if (= 404 (http-get-error-code c))



reply via email to

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