Ghost/ghost/email-service/lib
Chris Raible ee514a397c
Added configurable target delivery window for batch sending (#20719)
ref
https://linear.app/tryghost/issue/ONC-217/implement-the-deliverytime-option-in-mailgun-api-calls

Ghost experiences its highest peak load immediately after sending out a
newsletter, as it recieves an influx of traffic from users clicking on
the links in the email, a burst of email analytics events to process
from mailgun, and an increase in organic traffic to the site's frontend
as well as the admin analytics pages. The `BatchSendingService`
currently sends all the batches to Mailgun as quickly as possible, which
may contribute to higher peak loads.

This commit adds a `deliverytime` parameter to our API calls to Mailgun,
which allows us to specify a time in the future when we want the email
to be delivered. This will allow us to moderate the rate at which emails
are delivered, and in turn that should moderate the peak traffic volume
that Ghost receives in the first 2-3 minutes after sending an email.

The `deliverytime` is calculated based on a configurable parameter:
`bulkEmail.targetDeliveryWindow`, which specifies the maximum allowable
time (in milliseconds) after the email is first sent for Ghost to
instruct Mailgun to deliver the emails. Ghost will attempt to space out
all the batches as evenly as possible throughout the specified window.
For example, if the targetDeliveryWindow is set to `300000` (5 minutes)
and there are 100 batches, Ghost will set the `deliveryTime` for each
batch ~3 seconds apart.
2024-09-05 22:28:40 -07:00
..
email-templates Fixed blockquote horizontal spacing on Outlook (#20625) 2024-07-18 21:01:43 +08:00
helpers Added hasFeature email template helper (#20271) 2024-05-29 11:43:46 +07:00
BatchSendingService.js Added configurable target delivery window for batch sending (#20719) 2024-09-05 22:28:40 -07:00
EmailBodyCache.js Added eslint rule for file naming convention 2023-05-09 12:34:34 -04:00
EmailController.js Added test email rate limiting (#17505) 2023-07-27 08:46:50 +02:00
EmailEventProcessor.js Added eslint rule for file naming convention 2023-05-09 12:34:34 -04:00
EmailEventStorage.js Removed email from Mailgun's suppression list on unsubscribe (#18922) 2023-11-13 16:56:37 -03:00
EmailRenderer.js 🔒 Added uuid verification to member endpoints not requiring a session 2024-08-20 16:24:02 +02:00
EmailSegmenter.js Added quotes to NQL filters with ids (#18958) 2023-11-13 12:00:20 +01:00
EmailService.js Added [test] prefix to test emails (#19431) 2024-01-03 16:08:56 +00:00
MailgunEmailProvider.js Added configurable target delivery window for batch sending (#20719) 2024-09-05 22:28:40 -07:00
SendingService.js Added configurable target delivery window for batch sending (#20719) 2024-09-05 22:28:40 -07:00