bwlimit
authorJoey Hess <joeyh@joeyh.name>
Tue, 21 Sep 2021 20:58:02 +0000 (16:58 -0400)
committerJoey Hess <joeyh@joeyh.name>
Tue, 21 Sep 2021 20:58:10 +0000 (16:58 -0400)
commit18e00500ce7e0818da6b6f4ec5f67779468d1aa4
tree5b28f04b96dd2a74234b2e62d0b5e7f8b91968db
parentc9dd63d67ddeca64979748eb62fa84c537ed9b65
bwlimit

Added annex.bwlimit and remote.name.annex-bwlimit config that works for git
remotes and many but not all special remotes.

This nearly works, at least for a git remote on the same disk. With it set
to 100kb/1s, the meter displays an actual bandwidth of 128 kb/s, with
occasional spikes to 160 kb/s. So it needs to delay just a bit longer...
I'm unsure why.

However, at the beginning a lot of data flows before it determines the
right bandwidth limit. A granularity of less than 1s would probably improve
that.

And, I don't know yet if it makes sense to have it be 100ks/1s rather than
100kb/s. Is there a situation where the user would want a larger
granularity? Does granulatity need to be configurable at all? I only used that
format for the config really in order to reuse an existing parser.

This can't support for external special remotes, or for ones that
themselves shell out to an external command. (Well, it could, but it
would involve pausing and resuming the child process tree, which seems
very hard to implement and very strange besides.) There could also be some
built-in special remotes that it still doesn't work for, due to them not
having a progress meter whose displays blocks the bandwidth using thread.
But I don't think there are actually any that run a separate thread for
downloads than the thread that displays the progress meter.

Sponsored-by: Graham Spencer on Patreon
16 files changed:
Annex/Import.hs
Annex/StallDetection.hs
Annex/Transfer.hs
Annex/YoutubeDl.hs
CHANGELOG
Command/Add.hs
Messages/Progress.hs
Messages/Serialized.hs
Remote/Git.hs
Remote/Helper/P2P.hs
Remote/Helper/Special.hs
Remote/P2P.hs
Types/GitConfig.hs
Types/StallDetection.hs
Utility/Metered.hs
doc/git-annex.mdwn