Skip to content

Commit

Permalink
fix: fixed missing session in logger instance, added index for domains
Browse files Browse the repository at this point in the history
  • Loading branch information
titanism committed Feb 27, 2025
1 parent 515ee9b commit 92ed114
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
6 changes: 6 additions & 0 deletions app/models/domains.js
Original file line number Diff line number Diff line change
Expand Up @@ -505,6 +505,12 @@ Domains.index({
verification_record: 1
});

Domains.index({
name: 1,
verification_record: 1,
plan: 1
});

// Shared tangerine resolver
Domains.virtual('resolver')
.get(function () {
Expand Down
7 changes: 6 additions & 1 deletion app/models/logs.js
Original file line number Diff line number Diff line change
Expand Up @@ -551,6 +551,12 @@ Logs.pre('validate', function (next) {
}
});

//
// NOTE: if an email gets retried then a duplicate log won't show if it fails again
// this is because we use an email's `fingerprint` as the hash and we don't permit duplicate hash values
// (instead we could perhaps make a hash out of the `bounce_category` AND the `fingerprint` for more uniqueness in the future)
//

//
// we don't want to pollute our db (in addition to API endpoint rate limiting we check for duplicates)
//
Expand Down Expand Up @@ -714,7 +720,6 @@ function getQueryHash(log) {
// TODO: log.err.envelope.from log.err.envelope.to
// TODO: log.err.webhook
// TODO: log.err.bounces[x]
// TODO: log.meta.session.fingerprint <-- use this instead of hash

if (isSANB(log?.err?.address)) set.add(log.err.address);

Expand Down
2 changes: 1 addition & 1 deletion helpers/get-forwarding-addresses.js
Original file line number Diff line number Diff line change
Expand Up @@ -744,7 +744,7 @@ async function getForwardingAddresses(
forwardingAddresses.push(element);
}
} catch (err) {
logger.error(err);
logger.error(err, { session });
}
}

Expand Down

0 comments on commit 92ed114

Please sign in to comment.