Skip to content

[BUG] Throttler.bytesPerSecond() does not apply rate changes immediately #1822

Description

@amir1376

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions