Skip to content
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

[Mailer] Add retry_period option for email transport #54939

Open
wants to merge 1 commit into
base: 7.2
Choose a base branch
from

Conversation

sdespont
Copy link
Contributor

@sdespont sdespont commented May 16, 2024

Q A
Branch? 7.2
Bug fix? no
New feature? yes
Deprecations? no
Issues Fix #50981 #52551
License MIT

RoundRobinTransport constructor has retryPeriod set to 60 seconds. This cannot be configured right now.

Let's say all the transports fail (e.g. email address with domain that does not exist).
Problems:

  1. When sending more than one email synchronously we can't send emails following the one that failed. We have to sleep(x) where x >= 60sec. (of course we have to handle the TransportException thrown by invalid email but this is another topic)
  2. When using Messenger and async emails we don't have to worry about handling TransportException because invalid message will be sent back to the queue however the worker cannot consume another messages for the next 60 seconds. Also logs will be flooded with exceptions because in this 60s window a lot of messages could be tried.

This PR permits to specify a retry period using a new DNS option retry_period like MAILER_DSN="roundrobin(postmark+api://ID@default sendgrid+smtp://KEY@default)?retry_period=15"

@carsonbot

This comment was marked as off-topic.

@carsonbot carsonbot added this to the 7.1 milestone May 16, 2024
@nicolas-grekas nicolas-grekas modified the milestones: 7.1, 7.2 May 16, 2024
@carsonbot carsonbot changed the title Add retry_period option for email transport [Mailer] Add retry_period option for email transport May 17, 2024
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.

[Mailer] Make RoundRobinTransport retryPeriod configurable
3 participants