0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-20 22:42:53 -05:00

Fixed email analytics job not being registered when creating an email

no issue

- job registration was checking for submitted emails in it's email count but the job registration method is called as soon as an email is created meaning the email has a status of 'pending' which prevented the analytics job from being started until a second email was sent
This commit is contained in:
Kevin Ansfield 2020-12-02 14:47:18 +00:00
parent f802128cfc
commit 166d072cd4

View file

@ -17,8 +17,8 @@ module.exports = {
// don't register email analytics job if we have no emails,
// processer usage from many sites spinning up threads can be high
const emailCount = await models.Email
.where('status', 'submitted')
.where('created_at', '>', moment.utc().subtract(30, 'days').toDate())
.whereNot('status', 'failed')
.count();
if (emailCount > 0) {