Skip to content

Commit

Permalink
Revert "Fixed handling of await (#20804)"
Browse files Browse the repository at this point in the history
This reverts commit 3c9b8d6.
  • Loading branch information
9larsons committed Aug 27, 2024
1 parent 68f2ece commit 2bfcb8e
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ module.exports = {
const startDate = new Date();

// separate queries is much faster than using max/greatest (with coalesce to handle nulls) across columns
let maxOpenedAt = events.includes('opened') ? (await db.knex('email_recipients').select(db.knex.raw('MAX(opened_at) as maxOpenedAt')).first()).maxOpenedAt : null;
let maxDeliveredAt = events.includes('delivered') ? (await db.knex('email_recipients').select(db.knex.raw('MAX(delivered_at) as maxDeliveredAt')).first()).maxDeliveredAt : null;
let maxFailedAt = events.includes('failed') ? (await db.knex('email_recipients').select(db.knex.raw('MAX(failed_at) as maxFailedAt')).first()).maxFailedAt : null;
let maxOpenedAt = events.includes('opened') ? await db.knex('email_recipients').select(db.knex.raw('MAX(opened_at) as maxOpenedAt')).first().maxOpenedAt : null;
let maxDeliveredAt = events.includes('delivered') ? await db.knex('email_recipients').select(db.knex.raw('MAX(delivered_at) as maxDeliveredAt')).first().maxDeliveredAt : null;
let maxFailedAt = events.includes('failed') ? await db.knex('email_recipients').select(db.knex.raw('MAX(failed_at) as maxFailedAt')).first().maxFailedAt : null;

if (maxOpenedAt && !(maxOpenedAt instanceof Date)) {
// SQLite returns a string instead of a Date
Expand Down

0 comments on commit 2bfcb8e

Please sign in to comment.