0
Fork 0
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:
Kevin Ansfield 2020-12-01 10:15:01 +00:00
parent 622a57fc26
commit d604f96a9c

View file

@ -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: