Commit 91acfa8
committed
bug symfony#58763 [Messenger][RateLimiter] fix additional message handled when using a rate limiter (Jean-Beru)
This PR was merged into the 6.4 branch.
Discussion
----------
[Messenger][RateLimiter] fix additional message handled when using a rate limiter
| Q | A
| ------------- | ---
| Branch? | 6.4
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Issues | Fix symfony#57230
| License | MIT
Fix additional message handled by Messenger when using a rate limiter. A token was reserved but not consumed. See symfony#57230
With the following configuration:
```yaml
framework:
rate_limiter:
test:
policy: 'fixed_window'
limit: 1
interval: '10 seconds'
messenger:
transports:
test:
dsn: '%env(MESSENGER_TRANSPORT_DSN)%'
rate_limiter: 'test'
routing:
'App\Messenger\DoSomething': 'test'
```
Log generated by the MessageHandler:
```bash
$ bin/console messenger:consume test
[OK] Consuming messages from transport "test".
// The worker will automatically exit once it has received a stop signal via the messenger:stop-workers command.
// Quit the worker with CONTROL-C.
// Re-run the command with a -vv option to see logs about consumed messages.
09:13:48 WARNING [app] Message handled
09:13:58 WARNING [app] Message handled
09:13:58 WARNING [app] Message handled # Duplicated
09:14:08 WARNING [app] Message handled
09:14:08 WARNING [app] Message handled # Duplicated
09:14:18 WARNING [app] Message handled
09:14:18 WARNING [app] Message handled # Duplicated
```
After fix:
```bash
bin/console messenger:consume test
[OK] Consuming messages from transport "test".
// The worker will automatically exit once it has received a stop signal via the messenger:stop-workers command.
// Quit the worker with CONTROL-C.
// Re-run the command with a -vv option to see logs about consumed messages.
09:18:54 WARNING [app] Message handled
09:19:04 WARNING [app] Message handled
09:19:14 WARNING [app] Message handled
09:19:24 WARNING [app] Message handled
```
Commits
-------
ec1b999 [Messenger][RateLimiter] fix additional message handled when using a rate limiterFile tree
2 files changed
+17
-12
lines changed- src/Symfony/Component/Messenger
- Tests
2 files changed
+17
-12
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
17 | 18 | | |
18 | 19 | | |
19 | 20 | | |
| |||
47 | 48 | | |
48 | 49 | | |
49 | 50 | | |
| 51 | + | |
50 | 52 | | |
51 | | - | |
52 | 53 | | |
53 | 54 | | |
54 | 55 | | |
| |||
73 | 74 | | |
74 | 75 | | |
75 | 76 | | |
76 | | - | |
| 77 | + | |
77 | 78 | | |
78 | 79 | | |
79 | 80 | | |
| |||
403 | 404 | | |
404 | 405 | | |
405 | 406 | | |
406 | | - | |
| 407 | + | |
407 | 408 | | |
408 | 409 | | |
409 | 410 | | |
| |||
418 | 419 | | |
419 | 420 | | |
420 | 421 | | |
421 | | - | |
| 422 | + | |
422 | 423 | | |
423 | 424 | | |
424 | 425 | | |
| |||
438 | 439 | | |
439 | 440 | | |
440 | 441 | | |
| 442 | + | |
| 443 | + | |
441 | 444 | | |
442 | 445 | | |
443 | 446 | | |
444 | 447 | | |
445 | 448 | | |
446 | 449 | | |
447 | 450 | | |
448 | | - | |
| 451 | + | |
449 | 452 | | |
450 | 453 | | |
451 | | - | |
| 454 | + | |
452 | 455 | | |
453 | | - | |
454 | | - | |
455 | | - | |
| 456 | + | |
456 | 457 | | |
457 | 458 | | |
458 | 459 | | |
| |||
461 | 462 | | |
462 | 463 | | |
463 | 464 | | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
464 | 468 | | |
465 | 469 | | |
466 | 470 | | |
467 | | - | |
468 | | - | |
| 471 | + | |
| 472 | + | |
469 | 473 | | |
470 | 474 | | |
471 | 475 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
86 | 86 | | |
87 | 87 | | |
88 | 88 | | |
89 | | - | |
| 89 | + | |
90 | 90 | | |
91 | 91 | | |
92 | 92 | | |
| |||
242 | 242 | | |
243 | 243 | | |
244 | 244 | | |
| 245 | + | |
245 | 246 | | |
246 | 247 | | |
247 | 248 | | |
| |||
0 commit comments