Skip to content

Commit

Permalink
WIP: Experiments with async/await
Browse files Browse the repository at this point in the history
  • Loading branch information
nmagedman committed Jan 19, 2025
1 parent 6920a94 commit 76ea415
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,19 @@ Meteor.startup(async () => {
await cronJobs.add(CRON_JOB_NAME, CRON_JOB_SCHEDULE, async () => {
try {
if (settings.get("Seeking_Alpha__Report_on_Terms_of_Use_Violations")) {
perform(); // await??
await perform();
}
} catch (e: any) {
logger.error(`ERROR: CRONJOB: ${CRON_JOB_NAME}:`, e.message);
}
});
});

function perform() {
async function perform() {
const slack = new Slack(SLACK_TOKEN);

const keyword = TERMS_TO_MONITOR[0]; // Just search for one keyword for now. TODO: Search for all keywords
const docs = aggregateMessagesContainingKeyword(keyword, nDaysBeforeDate(14, today())); // yesterday());
const docs = await aggregateMessagesContainingKeyword(keyword, nDaysBeforeDate(14, today())); // yesterday());
const tsv = generateTSV(docs);
sendReportToSlack(tsv, slack);
}
Expand Down

0 comments on commit 76ea415

Please sign in to comment.