Hello 宋文武, [email protected] (宋文武) 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’.
