mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-03 23:00:14 -05:00
Added no-emails guard check when fetching latest email events
no issue - replicates the same guard used in `fetchLatest()` to prevent contacting Mailgun when there are no emails in the database
This commit is contained in:
parent
622a57fc26
commit
d604f96a9c
1 changed files with 6 additions and 0 deletions
|
@ -43,6 +43,12 @@ class EmailAnalyticsService {
|
|||
const result = new EventProcessingResult();
|
||||
const lastTimestamp = await this.getLastSeenEventTimestamp();
|
||||
|
||||
const emailCount = await this.db.knex('emails').count();
|
||||
if (emailCount <= 0) {
|
||||
debug('fetchAll: skipping - no emails to track');
|
||||
return result;
|
||||
}
|
||||
|
||||
const startFetch = new Date();
|
||||
debug('fetchLatest: starting');
|
||||
providersLoop:
|
||||
|
|
Loading…
Add table
Reference in a new issue