Skip to content

Commit

Permalink
Hotfix job board crash (#303)
Browse files Browse the repository at this point in the history
* More logging for debug

* Shift out of message cache before logging, in case the logger is throwing too
  • Loading branch information
vcarl authored Aug 9, 2023
1 parent d4de56e commit 5203bdb
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions src/features/jobs-moderation/job-mod-helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,15 +183,27 @@ export const deleteAgedPosts = async () => {
)}`,
);
} catch (e) {
jobBoardMessageCache.shift();
logger.log(
"[DEBUG]",
"DEBUG",
`deleteAgedPosts() message '${constructDiscordLink(
message,
)}' not found, originally sent by ${
message.author.username
} at ${format(message.createdAt, "P p")}`,
} at ${format(
message.createdAt,
"P p",
)}. Message cache has: [${jobBoardMessageCache
.map(
(c) =>
`${c.message.id} ${c.message.author.username} ${format(
c.message.createdAt,
"P p",
)}]`,
)
.join(",\n")}
${e}`,
);
jobBoardMessageCache.shift();
}
}
};
Expand Down

0 comments on commit 5203bdb

Please sign in to comment.