0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-24 23:48:13 -05:00
ghost/core/server
Kevin Ansfield d34a3263e8 Store email batch and recipient records when sending newsletters (#12195)
requires https://github.com/TryGhost/Ghost/pull/12192

- added initial `EmailBatch` and `EmailRecipient` model definitions with defaults and relationships
- added missing `post` relationship function to email model
- fetch member list without bookshelf
    - bookshelf can add around 3x overhead when fetching the members list for an email
    - we don't need full members at this point, only having the data is fine
    - if we need full models later on we can push the model hydration into background jobs where recipient batches are fetched ready for an email to be sent
    - bookshelf model instantiation of many models blocks the event loop, using knex directly keeps concurrent requests fast
    - adds `getFilteredCollectionQuery` method to base model to facilitate getting a knex query based on our normal model filters along with transaction/forUpdate applied
- store recipient list before sending email
    - chunk already-fetched members list into batches and insert records into the `email_recipients` table via knex
    - chunked into batches of 1000 to match the number of emails that Mailgun accepts in a single API request but this may not be the absolute fastest batch size for recipient insertion:
        | Batch size | Batch time | Total time |
        | ---------- | ---------- | ---------- |
        |        500 |       20ms |     4142ms |
        |       1000 |       50ms |     4651ms |
        |       5000 |      170ms |     3540ms |
        |      10000 |      370ms |     3684ms |
    - create an email_batch record before inserting recipient rows so we can effeciently fetch recipients by batch and store the overall batch status
2020-09-29 17:17:54 +01:00
..
adapters Replaced constants file with @tryghost/constants 2020-08-11 12:51:16 +01:00
api 🐛 Fixed CSV import json-schema email validation (#12239) 2020-09-29 12:51:35 +01:00
data Added migration to store from/reply-to values in email table (#12204) 2020-09-24 08:20:10 +01:00
lib Extracted promise libs and history into @tryghost/promise 2020-08-11 18:44:21 +01:00
models Store email batch and recipient records when sending newsletters (#12195) 2020-09-29 17:17:54 +01:00
public Added support for data-members-name in themes (#12191) 2020-09-23 13:59:26 +01:00
services Store email batch and recipient records when sending newsletters (#12195) 2020-09-29 17:17:54 +01:00
translations Updated Webhook API error message 2020-09-28 13:24:47 +02:00
views
web Added handling for new members support/reply email addresses 2020-08-31 18:09:38 +05:30
analytics-events.js
ghost-server.js Improved testmode logging of shutdown status 2020-08-18 15:48:42 +01:00
index.js Added routes.yaml content checksum storage to the db 2020-09-10 10:54:57 +12:00
overrides.js
update-check.js