Remove redundant batch param
This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -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: {
|
||||
|
||||
Reference in New Issue
Block a user