Ghost/ghost/mailgun-client
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
..
lib Added configurable target delivery window for batch sending (#20719) 2024-09-05 22:28:40 -07:00
test Added configurable target delivery window for batch sending (#20719) 2024-09-05 22:28:40 -07:00
.eslintrc.js Extracted Mailgun client to separate package 2022-08-10 17:12:37 +02:00
index.js Added eslint rule for file naming convention 2023-05-09 12:34:34 -04:00
package.json Update TryGhost packages 2024-08-05 12:12:34 +02:00
README.md Extracted Mailgun client to separate package 2022-08-10 17:12:37 +02:00

Mailgun Client

Mailgun client for Ghost

Usage

Test

  • yarn lint run just eslint
  • yarn test run lint and tests