Skip to content

Commit

Permalink
fix: added sorting to bounce report job
Browse files Browse the repository at this point in the history
  • Loading branch information
titanism committed Sep 6, 2023
1 parent b769064 commit ea48761
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions jobs/bounce-report.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ function makeDelimitedString(arr) {
},
bounce_category: { $ne: 'none' }
})
.sort({ bounce_category: 1 })
.sort({ created_at: 1, bounce_category: 1 })
.cursor()
.addCursorFlag('noCursorTimeout', true)) {
if (typeof log?.err?.bounceInfo?.category !== 'string') continue;
Expand Down Expand Up @@ -194,7 +194,7 @@ function makeDelimitedString(arr) {

// super rudimentary and simple string concatenation
const list = [];
for (const key of Object.keys(categories)) {
for (const key of Object.keys(categories).sort()) {
list.push(
`<li><strong>${titleize(humanize(key))}:</strong> ${
categories[key]
Expand All @@ -213,6 +213,7 @@ function makeDelimitedString(arr) {
`</ul>`,
`<p>Trusted hosts that were blocked:</p>`,
`<ul><li>${[...set]
.sort()
.map((h) => `<code>${h}</code>`)
.join('</li><li>')}</li></ul>`
].join('\n');
Expand Down

0 comments on commit ea48761

Please sign in to comment.