Skip to content

[RateLimiter] Call all compound limiters on failure and added IO blocking #38353

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 30, 2020

Conversation

wouterj
Copy link
Member

@wouterj wouterj commented Sep 30, 2020

Q A
Branch? master
Bug fix? yes
New feature? no
Deprecations? no
Tickets -
License MIT
Doc PR -

Two small improvements that I missed in #38257:

  • Added wait() method, to be able to do logic like this:
    while (!($limit = $limiter->consume())->isAccepted()) {
        $limit->wait();
    }
  • Fixed the CompoundLimiter to always call all limiters (even when one already blocks). This was the original behavior of the compound limiter and imho the best behavior (at least, it's always consistent and doesn't rely on the order of limiters - which is unsorted).

@wouterj wouterj force-pushed the rate-limiter-small-fixes branch from ab6a84c to 0279f88 Compare September 30, 2020 10:14
@fabpot
Copy link
Member

fabpot commented Sep 30, 2020

Thank you @wouterj.

@fabpot fabpot merged commit f06f2f0 into symfony:master Sep 30, 2020
@wouterj wouterj deleted the rate-limiter-small-fixes branch September 30, 2020 11:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants