Update email_notification.ts
This commit is contained in:
@@ -6,6 +6,7 @@ import { logger } from "../../../src/lib/logger";
|
|||||||
import { sendSlackWebhook } from "../alerts/slack";
|
import { sendSlackWebhook } from "../alerts/slack";
|
||||||
import { getNotificationString } from "./notification_string";
|
import { getNotificationString } from "./notification_string";
|
||||||
import { AuthCreditUsageChunk } from "../../controllers/v1/types";
|
import { AuthCreditUsageChunk } from "../../controllers/v1/types";
|
||||||
|
import { redlock } from "../redlock";
|
||||||
|
|
||||||
const emailTemplates: Record<
|
const emailTemplates: Record<
|
||||||
NotificationType,
|
NotificationType,
|
||||||
@@ -88,6 +89,7 @@ export async function sendNotificationInternal(
|
|||||||
if (team_id === "preview") {
|
if (team_id === "preview") {
|
||||||
return { success: true };
|
return { success: true };
|
||||||
}
|
}
|
||||||
|
return await redlock.using([`notification-lock:${team_id}:${notificationType}`], 5000, async () => {
|
||||||
|
|
||||||
if (!bypassRecentChecks) {
|
if (!bypassRecentChecks) {
|
||||||
const fifteenDaysAgo = new Date();
|
const fifteenDaysAgo = new Date();
|
||||||
@@ -172,4 +174,5 @@ export async function sendNotificationInternal(
|
|||||||
}
|
}
|
||||||
|
|
||||||
return { success: true };
|
return { success: true };
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user