mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-03 23:00:14 -05:00
Adjusted email jobs registration to check for emails newer than 30 days
no issue - if emails are older than 30 days we wouldn't be able to fetch any analytics for them and if a site used emails in the past but is no longer using them it doesn't make sense to keep potentially expensive background worker threads spinning up
This commit is contained in:
parent
947603d0e3
commit
92ef83c61a
1 changed files with 4 additions and 1 deletions
|
@ -14,7 +14,10 @@ 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.count();
|
||||
const emailCount = await models.Email
|
||||
.where('status', 'submitted')
|
||||
.where('created_at', '>', moment.utc().subtract(30, 'days').toDate())
|
||||
.count();
|
||||
|
||||
if (emailCount > 0) {
|
||||
// use a random seconds value to avoid spikes to external APIs on the minute
|
||||
|
|
Loading…
Add table
Reference in a new issue