Files
pangolin/server/private/lib/alerts/processTestAlerts.ts
T
2026-08-07 20:52:25 +02:00

23 lines
760 B
TypeScript

import logger from "@server/logger";
import type { TestAlertContext } from "@server/routers/alertRule/types";
import { sendAlertEmail } from "./sendAlertEmail";
export async function processTestAlerts(context: TestAlertContext) {
const emailActions = context.actions.filter(
(action) => action.type === "email"
);
// Process email actions
for (const action of emailActions) {
try {
const recipients = await resolveEmailRecipients(
action.emailActionId
);
if (recipients.length > 0) {
await sendAlertEmail(recipients, context);
}
} catch (err) {
logger.error(`processAlerts: failed to send alert email`, err);
}
}
}