When increasing the rate limit using Throttler.bytesPerSecond(), the new limit is not applied immediately if bytes have already been allocated into the future.
For example, if the throttler is configured with a very low rate (e.g. 1 KB/s) and the limit is then increased, reads continue to wait according to the previous allocation schedule before the higher rate takes effect.
This makes Throttler effectively unusable for applications such as download managers, where users expect speed limit changes to take effect immediately.
Is the current behavior intentional?
If preserving the current behavior is important, would you consider making it optional to reset the allocation schedule when changing the rate? I'd be happy to submit a PR if that's something you'd be interested in.
When increasing the rate limit using
Throttler.bytesPerSecond(), the new limit is not applied immediately if bytes have already been allocated into the future.For example, if the throttler is configured with a very low rate (e.g. 1 KB/s) and the limit is then increased, reads continue to wait according to the previous allocation schedule before the higher rate takes effect.
This makes
Throttlereffectively unusable for applications such as download managers, where users expect speed limit changes to take effect immediately.Is the current behavior intentional?
If preserving the current behavior is important, would you consider making it optional to reset the allocation schedule when changing the rate? I'd be happy to submit a PR if that's something you'd be interested in.