diff options
author | Christopher Baines <mail@cbaines.net> | 2021-03-17 23:10:22 +0000 |
---|---|---|
committer | Christopher Baines <mail@cbaines.net> | 2021-03-17 23:12:31 +0000 |
commit | 806125e52f1b94f8eff74daecc5306b5934bb616 (patch) | |
tree | edcc94edd1e08c969bd48517a9bd082beb222f86 /guix/scripts/weather.scm | |
parent | 966e61fb8f3ae1313545db7ed9994bc290666ee9 (diff) |
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.
Diffstat (limited to 'guix/scripts/weather.scm')
-rw-r--r-- | guix/scripts/weather.scm | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/guix/scripts/weather.scm b/guix/scripts/weather.scm index 349052459c..5164fe0494 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)) |