From 5a65e6f6da9b81f7031f26089f8010b46ed85b36 Mon Sep 17 00:00:00 2001 From: Cadence Ember Date: Wed, 17 Jul 2024 12:08:04 +1200 Subject: [PATCH] Only retrigger once, just in case --- d2m/actions/retrigger.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/d2m/actions/retrigger.js b/d2m/actions/retrigger.js index 2475daf5..030ffbf9 100644 --- a/d2m/actions/retrigger.js +++ b/d2m/actions/retrigger.js @@ -18,7 +18,7 @@ const emitter = new EventEmitter() * Due to Eventual Consistency(TM) an update/delete may arrive before the original message arrives * (or before the it has finished being bridged to an event). * In this case, wait until the original message has finished bridging, then retrigger the passed function. - * @template {(...args: any) => Promise} T + * @template {(...args: any[]) => Promise} T * @param {string} messageID * @param {T} fn * @param {Parameters} rest @@ -32,7 +32,7 @@ function eventNotFoundThenRetrigger(messageID, fn, ...rest) { } debugRetrigger(`[retrigger] WAIT mid <-> eid = ${messageID} <-> ${eventID}`) - emitter.addListener(messageID, () => { + emitter.once(messageID, () => { debugRetrigger(`[retrigger] TRIGGER mid = ${messageID}`) fn(...rest) })