Skip to content

Commit 59cf651

Browse files
committed
chore: add sentry capture cron jobs error
1 parent eb22c6e commit 59cf651

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

src/jobs/ping.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
import log from "../components/utils/log";
22
import client from "../components/client";
33
import { CronJobInfo } from "../cron";
4+
import * as Sentry from "@sentry/node";
45

56
export const info: CronJobInfo = {
67
name: "Ping",
78
description: "Ping WhatsApp Client",
8-
schedule: "*/5 * * * *", // every 5 minutes
9+
schedule: "0 * * * *", // every hour
910
runOnStartup: false,
1011
};
1112

@@ -17,6 +18,7 @@ export default async function () {
1718
`Successfully fetched ${chats.length} chats to keep session alive.`,
1819
);
1920
} catch (err) {
21+
Sentry.captureException(err);
2022
log.error("Ping", err);
2123
}
2224
}

src/jobs/speedtest.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import speedTest from "speedtest-net";
22
import log from "../components/utils/log";
33
import redis from "../components/redis";
44
import { CronJobInfo } from "../cron";
5+
import * as Sentry from "@sentry/node";
56

67
export const CACHE_KEY = "speedtest:result";
78
const CACHE_TTL = 60 * 60; // 1 hour
@@ -33,6 +34,7 @@ export default async function () {
3334
},
3435
});
3536
} catch (err) {
37+
Sentry.captureException(err);
3638
log.error("SpeedTestJob", err);
3739
}
3840
}

0 commit comments

Comments
 (0)