mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-10 23:36:14 -05:00
Fixed knex connection pool errors when scheduling a posts
no issue - A subquery in mege service that creates email record wasn't using 'options' object needed to track transactions
This commit is contained in:
parent
4790e64256
commit
9ff5fecbaf
2 changed files with 3 additions and 3 deletions
|
@ -155,7 +155,7 @@ module.exports = {
|
||||||
let postEmail = model.relations.email;
|
let postEmail = model.relations.email;
|
||||||
|
|
||||||
if (!postEmail) {
|
if (!postEmail) {
|
||||||
const email = await mega.addEmail(model.toJSON());
|
const email = await mega.addEmail(model.toJSON(), frame.options);
|
||||||
model.set('email', email);
|
model.set('email', email);
|
||||||
} else if (postEmail && postEmail.get('status') === 'failed') {
|
} else if (postEmail && postEmail.get('status') === 'failed') {
|
||||||
const email = await mega.retryFailedEmail(postEmail);
|
const email = await mega.retryFailedEmail(postEmail);
|
||||||
|
|
|
@ -57,7 +57,7 @@ const sendTestEmail = async (postModel, emails) => {
|
||||||
*
|
*
|
||||||
* @param {object} post JSON object
|
* @param {object} post JSON object
|
||||||
*/
|
*/
|
||||||
const addEmail = async (post) => {
|
const addEmail = async (post, options) => {
|
||||||
const {members} = await membersService.api.members.list(Object.assign({filter: 'subscribed:true'}, {limit: 'all'}));
|
const {members} = await membersService.api.members.list(Object.assign({filter: 'subscribed:true'}, {limit: 'all'}));
|
||||||
const {emailTmpl, emails} = getEmailData(post, members);
|
const {emailTmpl, emails} = getEmailData(post, members);
|
||||||
|
|
||||||
|
@ -77,7 +77,7 @@ const addEmail = async (post) => {
|
||||||
html: emailTmpl.html,
|
html: emailTmpl.html,
|
||||||
plaintext: emailTmpl.plaintext,
|
plaintext: emailTmpl.plaintext,
|
||||||
submitted_at: moment().toDate()
|
submitted_at: moment().toDate()
|
||||||
});
|
}, {transacting: options.transacting});
|
||||||
} else {
|
} else {
|
||||||
return existing;
|
return existing;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue