This commit is contained in:
Ralfs 2021-04-10 13:06:36 +03:00
parent 6eef5a55e7
commit 0b5580274d
1 changed files with 1 additions and 6 deletions

View File

@ -32,11 +32,6 @@ app.use(mongo({ uri: config.dbConnectionString }, { useUnifiedTopology: true }))
initiateTelegramBot();
router.get('/', async(ctx, next) => {
ctx.res.statusCode = 200;
await next();
})
router.post('/alerts', async(ctx, next) => {
try {
const alert = ctx.request.body;
@ -82,7 +77,7 @@ app.listen(config.port, () => {
const runCron = async () => {
const mongoConnection = await MongoClient.connect(config.dbConnectionString, { useUnifiedTopology: true });
const db = mongoConnection.db(config.db);
cron.schedule("1 * * * *", async () => {
cron.schedule("* * * * *", async () => {
try {
const alerts = await db.collection('alerts').find({open: true}).toArray();
const uniqueMangoGroupPks: string[] = [...new Set(alerts.map(alert => alert.mangoGroupPk))];