Commit c15a195
committed
bug symfony#58601 [RateLimiter] Fix bucket size reduced when previously created with bigger size (Orkin)
This PR was merged into the 6.4 branch.
Discussion
----------
[RateLimiter] Fix bucket size reduced when previously created with bigger size
| Q | A
| ------------- | ---
| Branch? | 6.4
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Issues | Fix #
| License | MIT
```yaml
foo:
policy: 'token_bucket'
limit: 1000
rate: { interval: '15 minutes', amount: 5 }
cache_pool: rate_limiter.cache_pool
lock_factory: 'lock.rate_limiter.factory'
```
`rate_limiter.cache_pool` => it's a persistent cache pool like redis
When using previously this configuration and consume the token bucket with 1 token it was save on the storage with 999 tokens available.
If you update the configuration with a lower token limit
```yaml
foo:
policy: 'token_bucket'
limit: 10
rate: { interval: '15 minutes', amount: 5 }
cache_pool: rate_limiter.cache_pool
lock_factory: 'lock.rate_limiter.factory'
```
You can consume 999 tokens before triggering the bucket limit without flushing the cache. The purpose of this PR is to update and use the new configuration limit.
Commits
-------
6c34c58 Fix bucket size reduce when previously created with bigger sizeFile tree
2 files changed
+16
-0
lines changed- src/Symfony/Component/RateLimiter
- Policy
- Tests/Policy
2 files changed
+16
-0
lines changedLines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
67 | 67 | | |
68 | 68 | | |
69 | 69 | | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
70 | 74 | | |
71 | 75 | | |
72 | 76 | | |
| |||
Lines changed: 12 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
59 | 71 | | |
60 | 72 | | |
61 | 73 | | |
| |||
0 commit comments