guix-devel
[Top][All Lists]
Advanced

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

Re: [WIP][PATCH] download: Don't report the progress too fast


From: Ludovic Courtès
Subject: Re: [WIP][PATCH] download: Don't report the progress too fast
Date: Wed, 30 Aug 2017 10:45:51 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux)

Hello 宋文武,

address@hidden (宋文武) skribis:

> Hello, our progress report of 'guix download' can refresh too fast.  For
> example, it blinks much with this script:

Indeed, that’s always annoyed me.  I’m glad you’re looking at it!

> I'd like limiting its rate to render every 300ms.  So I write a
> higher-order function that does nothing when the previous invocation not
> happened some time (the interval) ago.  For lacking a proper name in my
> mind, I just call it 'rate-limited'.  Then using it to modify the
> 'progress-proc', let it render every 300ms.
>
> It seems working as I want, but will lost the last report, the progress
> will never finish to 100%...  There is no way to know a report is the
> last or not in the 'progress-proc' with only the 'transferred' parameter
> when the 'size' of file is unknown.

What about sacrificing elegance, and instead put that logic directly in
‘progress-proc’ itself, where we know whether we’re at 100% or not?  I’m
very much in favor of pragmatic choices in such circumstances.

(Also, longer-term, we’d want to do that other way around, which is to
update the report every N milliseconds, as opposed to just printing
something when a chunk has been transferred.)

WDYT?

Ludo’.



reply via email to

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