Skip to content

Commit 4f2109f

Browse files
committed
Don’t rate limit webhooks
1 parent 035245e commit 4f2109f

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

apps/webapp/app/v3/services/alerts/deliverAlert.server.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ import { commonWorker } from "~/v3/commonWorker.server";
3636
import { FINAL_ATTEMPT_STATUSES } from "~/v3/taskStatus";
3737
import { BaseService } from "../baseService.server";
3838
import { generateFriendlyId } from "~/v3/friendlyIdentifiers";
39-
import { ProjectAlertType } from "@trigger.dev/database";
39+
import { ProjectAlertChannelType, ProjectAlertType } from "@trigger.dev/database";
4040
import { alertsRateLimiter } from "~/v3/alertsRateLimiter.server";
4141
import { v3RunPath } from "~/utils/pathBuilder";
4242
import { isOOMError } from "../completeAttempt.server";
@@ -1068,13 +1068,15 @@ export class DeliverAlertService extends BaseService {
10681068
static async createAndSendAlert(
10691069
{
10701070
channelId,
1071+
channelType,
10711072
projectId,
10721073
environmentId,
10731074
alertType,
10741075
deploymentId,
10751076
taskRunId,
10761077
}: {
10771078
channelId: string;
1079+
channelType: ProjectAlertChannelType;
10781080
projectId: string;
10791081
environmentId: string;
10801082
alertType: ProjectAlertType;
@@ -1083,7 +1085,7 @@ export class DeliverAlertService extends BaseService {
10831085
},
10841086
db: PrismaClientOrTransaction
10851087
) {
1086-
if (taskRunId) {
1088+
if (taskRunId && channelType !== "WEBHOOK") {
10871089
try {
10881090
const result = await alertsRateLimiter.check(channelId);
10891091

apps/webapp/app/v3/services/alerts/performDeploymentAlerts.server.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ export class PerformDeploymentAlertsService extends BaseService {
4949
await DeliverAlertService.createAndSendAlert(
5050
{
5151
channelId: alertChannel.id,
52+
channelType: alertChannel.type,
5253
projectId: deployment.projectId,
5354
environmentId: deployment.environmentId,
5455
alertType,

apps/webapp/app/v3/services/alerts/performTaskRunAlerts.server.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ export class PerformTaskRunAlertsService extends BaseService {
4949
await DeliverAlertService.createAndSendAlert(
5050
{
5151
channelId: alertChannel.id,
52+
channelType: alertChannel.type,
5253
projectId: run.projectId,
5354
environmentId: run.runtimeEnvironmentId,
5455
alertType: "TASK_RUN",

0 commit comments

Comments
 (0)