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: Sat, 22 Feb 2020 12:12:33 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux)

Hi!

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.

[...]

> +(define %disk-space-warning-absolute
> +  ;; The decimal number of GiB of free disk space below which a warning is
> +  ;; emitted.
> +  (make-parameter (match (and=> (getenv "GUIX_DISK_SPACE_WARNING_ABSOLUTE")
> +                                string->number)
> +                    (#f        17.0)
> +                    (threshold threshold))))

Perhaps we should arrange for ‘GUIX_DISK_SPACE_WARNING’ to handle both
cases?

That is, we’d first try to convert it with ‘size->number’; if that
works, it’s an absolute measure, and if it returns #f, then pass the
string to ‘string->number’ and assume it’s a fraction.

Does that make sense?

> +         (absolute-threshold-in-bytes (* 1024 1024 1024 absolute-threshold)))

Always use bytes internally; that is, convert to bytes at the UI border.

Thanks,
Ludo’.





reply via email to

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