From 9e3fe5db730d1b05ba1b3ee707f7651e74938b41 Mon Sep 17 00:00:00 2001 From: Zef Hemel Date: Sun, 18 Aug 2024 12:36:23 +0200 Subject: [PATCH] Add pollInterval option to mqSubscriptions #1021 --- lib/manifest.ts | 1 + lib/plugos/hooks/mq.ts | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/manifest.ts b/lib/manifest.ts index 8d1dcff8..c2210eda 100644 --- a/lib/manifest.ts +++ b/lib/manifest.ts @@ -30,6 +30,7 @@ export type EventHookT = { type MQSubscription = { queue: string; batchSize?: number; + pollInterval?: number; autoAck?: boolean; }; export type MQHookT = { diff --git a/lib/plugos/hooks/mq.ts b/lib/plugos/hooks/mq.ts index d57f4875..7604c8e2 100644 --- a/lib/plugos/hooks/mq.ts +++ b/lib/plugos/hooks/mq.ts @@ -52,12 +52,13 @@ export class MQHook implements Hook { const subscriptions = functionDef.mqSubscriptions; for (const subscriptionDef of subscriptions) { const queue = subscriptionDef.queue; - // console.log("Subscribing to queue", queue); + // console.log("Subscribing to queue", queue, subscriptionDef); this.subscriptions.push( this.mq.subscribe( queue, { batchSize: subscriptionDef.batchSize, + pollInterval: subscriptionDef.pollInterval, }, async (messages: MQMessage[]) => { try {