Remove redundant batch param

This commit is contained in:
nicktrn
2023-12-07 09:09:36 +00:00
parent 61b7a7aa83
commit d330134c6b
2 changed files with 7 additions and 6 deletions
@@ -11,7 +11,7 @@ export class DeliverWebhookRequestService {
this.#prismaClient = prismaClient;
}
public async call(webhookEnvironmentId: string, requestDeliveryIds: string[], batched = false) {
public async call(webhookEnvironmentId: string, requestDeliveryIds: string[]) {
const webhookEnvironment = await this.#prismaClient.webhookEnvironment.findUniqueOrThrow({
where: {
id: webhookEnvironmentId,
@@ -31,6 +31,7 @@ export class DeliverWebhookRequestService {
},
},
},
deliveryBatcher: true,
environment: {
include: {
organization: true,
@@ -58,7 +59,7 @@ export class DeliverWebhookRequestService {
throw new Error(`No request deliveries found, expected ${requestDeliveryIds.length} total.`);
}
if (!batched && requestDeliveries.length > 1) {
if (requestDeliveries.length > 1 && !webhookEnvironment.deliveryBatcher) {
throw new Error(
`Batching is disabled. Will not handle multiple deliveries. Requested ${requestDeliveryIds.length} total.`
);
@@ -96,7 +97,7 @@ export class DeliverWebhookRequestService {
secret: secret.secret,
params: webhookEnvironment.webhook.params,
requests,
batched,
batched: !!webhookEnvironment.deliveryBatcher,
});
const deliveredAt = new Date();
+3 -3
View File
@@ -255,7 +255,7 @@ function getWorkerQueue() {
throw new Error("Job key is required for batch jobs.");
}
const batcherId = job.key.split(":")[0]
const batcherId = job.key.split(":")[0];
const service = new DispatchBatcherService();
@@ -353,7 +353,7 @@ function getWorkerQueue() {
throw new Error("Job key is required for batch jobs.");
}
const batcherId = job.key.split(":")[0]
const batcherId = job.key.split(":")[0];
const service = new WebhookDeliveryBatcherService();
@@ -367,7 +367,7 @@ function getWorkerQueue() {
handler: async (payload, job) => {
const service = new DeliverWebhookRequestService();
await service.call(payload.webhookEnvironmentId, payload.requestDeliveryIds, true);
await service.call(payload.webhookEnvironmentId, payload.requestDeliveryIds);
},
},
deliverWebhookRequest: {