-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Messenger] rate limited transport processes more messages than configured #57230
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
Labels
Comments
Please create a reproducer app with a numbered list of steps to execute (setup script would be even better) so others can just git clone and execute the use case. |
Reproduction:
![]() |
fabpot
added a commit
that referenced
this issue
Nov 9, 2024
…en 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 #57230 | License | MIT Fix additional message handled by Messenger when using a rate limiter. A token was reserved but not consumed. See #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 limiter
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Symfony version(s) affected
6.4.x
Description
I was testing a rate limited mailer messenger transport configuration and noticed that more messages were consumed by the messenger than the rate limit actually allows - at least with a certain configuration.
How to reproduce
Create a configuration that looks like this for example:
i.e. only allow 1 email per minute. Then execute
messenger:setup-transports
.Then create a bunch of emails in your system. Unfortunately you cannot use the
mailer:test
command for that as it directly sends the email rather than using theMailer
service to send it via the messenger bus - so you'll have to create your own command/service/code that sends a bunch of email messages via theMailer
.Now execute
messenger:consume mailer
to keep consuming messages for themailer
messenger transport. You will notice that at first only one email is sent. However, after every 60 seconds two emails are sent after that, instead of the expected one email per minute.Possible Solution
No response
Additional Context
No response
The text was updated successfully, but these errors were encountered: