fix: add error handling to dokploy restart notifications

This commit is contained in:
Mauricio Siu
2026-02-22 20:05:58 -06:00
parent 5435e1dac4
commit e3aadf1908

View File

@@ -19,27 +19,28 @@ import {
} from "./utils"; } from "./utils";
export const sendDokployRestartNotifications = async () => { export const sendDokployRestartNotifications = async () => {
const date = new Date(); try {
const unixDate = ~~(Number(date) / 1000); const date = new Date();
const notificationList = await db.query.notifications.findMany({ const unixDate = ~~(Number(date) / 1000);
where: eq(notifications.dokployRestart, true), const notificationList = await db.query.notifications.findMany({
with: { where: eq(notifications.dokployRestart, true),
email: true, with: {
discord: true, email: true,
telegram: true, discord: true,
slack: true, telegram: true,
resend: true, slack: true,
gotify: true, resend: true,
ntfy: true, gotify: true,
custom: true, ntfy: true,
lark: true, custom: true,
pushover: true, lark: true,
teams: true, pushover: true,
}, teams: true,
}); },
});
for (const notification of notificationList) { for (const notification of notificationList) {
const { const {
email, email,
resend, resend,
discord, discord,
@@ -267,5 +268,8 @@ export const sendDokployRestartNotifications = async () => {
} catch (error) { } catch (error) {
console.log(error); console.log(error);
} }
}
} catch (error) {
console.error("[Dokploy] Restart notifications failed:", error);
} }
}; };