guix-patches
[Top][All Lists]
Advanced

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

[bug#39734] [PATCH] scripts: Emit GC hint if free space is lower than ab


From: Ludovic Courtès
Subject: [bug#39734] [PATCH] scripts: Emit GC hint if free space is lower than absolute and relative threshold.
Date: Mon, 24 Feb 2020 22:08:54 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux)

Pierre Neidhardt <address@hidden> skribis:

> * guix/scripts.scm (%disk-space-warning-absolute): New variable.
> (warn-about-disk-space): Test against %disk-space-warning-absolute.
> Fix error in display-hint due to extraneous 'profile' argument.

[...]

> +  (let* ((default-absolute-threshold (size->number "5GiB"))
> +         (default-relative-threshold 0.05)
> +         (percentage->float (lambda (percentage)
> +                              (or (and=> (string->number
> +                                          (car (string-split percentage 
> #\%)))

Mayes just: (string-drop-right percentage 1).

> +         (absolute? (lambda (size)
> +                      (if (string-suffix? "%" size)
> +                          #f
> +                          (false-if-exception (<= 100 (size->number 
> size)))))))

Maybe: (not (or (string-suffix? …) (false-if-exception …)))

Otherwise LGTM.

Thank you!

Ludo’, who actually saw the warning way too often.  :-)





reply via email to

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