Consider test and external account when batching

This commit is contained in:
nicktrn
2023-12-06 15:02:30 +00:00
parent 3db8febd68
commit d5ac3423cd
2 changed files with 17 additions and 3 deletions
@@ -74,9 +74,19 @@ export class DeliverEventService {
if (eventDispatcher.batcher) {
const { maxPayloads, runAt } = this.#getBatchEnqueueOptions(eventDispatcher.batcher);
const jobKeyParts = [eventDispatcher.id];
if (eventRecord.isTest) {
jobKeyParts.push(String(eventRecord.isTest));
}
if (eventRecord.externalAccountId) {
jobKeyParts.push(eventRecord.externalAccountId);
}
return workerQueue.batchEnqueue("events.invokeDispatchBatcher", [eventRecord.id], {
tx,
jobKey: eventDispatcher.id,
jobKey: jobKeyParts.join(":"),
maxPayloads,
runAt,
});
+6 -2
View File
@@ -255,9 +255,11 @@ function getWorkerQueue() {
throw new Error("Job key is required for batch jobs.");
}
const batcherId = job.key.split(":")[0]
const service = new DispatchBatcherService();
await service.call(job.key, payload);
await service.call(batcherId, payload);
},
},
"events.invokeBatchDispatcher": {
@@ -351,9 +353,11 @@ function getWorkerQueue() {
throw new Error("Job key is required for batch jobs.");
}
const batcherId = job.key.split(":")[0]
const service = new WebhookDeliveryBatcherService();
await service.call(job.key, payload);
await service.call(batcherId, payload);
},
},
deliverMultipleWebhookRequests: {