Skip to content

Commit

Permalink
TMP: DEBUG for Staging
Browse files Browse the repository at this point in the history
- Run every 5 minutes, not daily
- Grab 2 weeks of messages, not just yesterday
  • Loading branch information
nmagedman committed Jan 26, 2025
1 parent 7b24dd5 commit 828c185
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ import { readSecondaryPreferred } from '../../../server/database/readSecondaryPr
import { settings } from '../../settings/server';
import Slack from '../utils/Slack';
import { generateCSV } from '../utils/csv';
import { yesterday, theDayAfter } from '../utils/datetime_functions';
import { yesterday, theDayAfter, today, nDaysBeforeDate } from '../utils/datetime_functions';


const CRON_JOB_NAME = 'seeking-alpha-terms-of-use-violations';
const CRON_JOB_SCHEDULE = '15 8 * * *';
const CRON_JOB_SCHEDULE = '*/5 * * * *'; // '15 8 * * *';

// To find a Slack channel’s channel ID, open the room in the Slack UI,
// 3-dots > Open channel details > Channel ID (at bottom)
Expand Down Expand Up @@ -53,7 +53,7 @@ async function perform() {
const attachments = [];

const promises = TERMS_TO_MONITOR.map(
keyword => aggregateMessagesContainingKeyword(keyword, yesterday())
keyword => aggregateMessagesContainingKeyword(keyword, nDaysBeforeDate(14, today()))
);
const aggregations = await Promise.all(promises);

Expand Down Expand Up @@ -97,7 +97,7 @@ function buildMongoMatchDoc(searchPattern, date) {
return {
ts: {
$gte: date,
$lt: theDayAfter(date),
$lt: theDayAfter(today()),
},
msg: RegExp(searchPattern, 'i'),
};
Expand Down

0 comments on commit 828c185

Please sign in to comment.