Skip to content

Commit

Permalink
Remove an async/await pair that might be causing problems
Browse files Browse the repository at this point in the history
  • Loading branch information
nmagedman committed Jan 20, 2025
1 parent cdf09ad commit 1842ac6
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@ async function perform() {
const slack = new Slack(SLACK_TOKEN);
const attachments = [];

TERMS_TO_MONITOR.forEach(async (keyword) => {
const docs = await aggregateMessagesContainingKeyword(keyword, nDaysBeforeDate(14, today())); // yesterday());
TERMS_TO_MONITOR.forEach((keyword) => {
const docs = aggregateMessagesContainingKeyword(keyword, nDaysBeforeDate(14, today())); // yesterday());
LOG.info(`docs = ${docs} [${typeof docs}]`);
if (docs) {
if (docs && docs.length !== 0) {
attachments.push({
filename: `${keyword}.tsv`,
content: generateTSV(docs),
Expand All @@ -58,8 +58,10 @@ async function perform() {
LOG.info(`attachments.length == ${attachments.length}`);

if (attachments.length === 0) {
LOG.info("No RocketChat TOU violations today!");
slack.post_message(SLACK_CHANNEL_ID, "No RocketChat TOU violations today!")
} else {
LOG.info(`RocketChat TOU Violations: attachments.length => ${attachments.length}`);
slack.post_attachments(SLACK_CHANNEL_ID, attachments, "RocketChat TOU Violations:");
}
}
Expand Down

0 comments on commit 1842ac6

Please sign in to comment.