0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-03 23:00:14 -05:00
ghost/core/server/services
Kevin Ansfield 80af56b530
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
- 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-14 15:40:00 +01:00
..
adapter-manager Moved config from server to shared (#11850) 2020-05-27 18:47:53 +01:00
auth Extracted core/server/lib/security to @tryghost/security package 2020-08-11 14:06:50 +01:00
bulk-email Fixed missing domain for default support address 2020-09-03 16:34:47 +05:30
invitations 🐛 Fixed error caused by accepting invitation with existing email (#12172) 2020-09-09 11:58:53 +12:00
jobs Added job-manager & wired up shutdown and testmode 2020-08-11 21:31:34 +01:00
mail Updated error name check in GhostMailer 2020-07-21 01:08:19 +05:30
mega Store email batch and recipient records when sending newsletters (#12195) 2020-09-14 15:40:00 +01:00
members 🐛 Fixed table constraint error when updating member's email with an already existing email (#12178) 2020-09-10 16:03:57 +12:00
permissions Improved password reset and session invalidation for "locked" users (#11790) 2020-05-05 19:37:53 +01:00
settings Added routes.yaml content checksum storage to the db 2020-09-10 10:54:57 +12:00
webhooks Extracted promise libs and history into @tryghost/promise 2020-08-11 18:44:21 +01:00
labs.js Moved core/server/lib/common/logging to core/shared/logging (#11857) 2020-05-28 19:30:23 +01:00
slack.js Moved core/server/lib/common/logging to core/shared/logging (#11857) 2020-05-28 19:30:23 +01:00
xmlrpc.js Moved core/server/lib/common/logging to core/shared/logging (#11857) 2020-05-28 19:30:23 +01:00