mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-03-11 02:12:21 -05:00
Disabled model auto-refresh when processing email batches
- by default, the model will auto-refresh when you save - in MySQL, which doesn't support RETURNING, this is implemented by doing a SELECT after your actual query - `email_recipients` is a huge table and `processed_at` is not an indexed column, so the query times can become realllyyyyyyy big - given we don't even need the result of the model save, we can just disable fetching all the affected records again - Bookshelf gives us this ability in the form of `autoRefresh: false`
This commit is contained in:
parent
bb9a797283
commit
1c7d4e49c5
1 changed files with 1 additions and 1 deletions
|
@ -197,7 +197,7 @@ module.exports = {
|
|||
// update all email recipients with a processed_at
|
||||
await models.EmailRecipient
|
||||
.where({batch_id: emailBatchId})
|
||||
.save({processed_at: moment()}, Object.assign({}, knexOptions, {patch: true}));
|
||||
.save({processed_at: moment()}, Object.assign({}, knexOptions, {autoRefresh: false, patch: true}));
|
||||
}
|
||||
},
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue