Only retrigger once, just in case
This commit is contained in:
parent
a2f0bb79db
commit
5a65e6f6da
1 changed files with 2 additions and 2 deletions
|
@ -18,7 +18,7 @@ const emitter = new EventEmitter()
|
||||||
* Due to Eventual Consistency(TM) an update/delete may arrive before the original message arrives
|
* 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).
|
* (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.
|
* In this case, wait until the original message has finished bridging, then retrigger the passed function.
|
||||||
* @template {(...args: any) => Promise<any>} T
|
* @template {(...args: any[]) => Promise<any>} T
|
||||||
* @param {string} messageID
|
* @param {string} messageID
|
||||||
* @param {T} fn
|
* @param {T} fn
|
||||||
* @param {Parameters<T>} rest
|
* @param {Parameters<T>} rest
|
||||||
|
@ -32,7 +32,7 @@ function eventNotFoundThenRetrigger(messageID, fn, ...rest) {
|
||||||
}
|
}
|
||||||
|
|
||||||
debugRetrigger(`[retrigger] WAIT mid <-> eid = ${messageID} <-> ${eventID}`)
|
debugRetrigger(`[retrigger] WAIT mid <-> eid = ${messageID} <-> ${eventID}`)
|
||||||
emitter.addListener(messageID, () => {
|
emitter.once(messageID, () => {
|
||||||
debugRetrigger(`[retrigger] TRIGGER mid = ${messageID}`)
|
debugRetrigger(`[retrigger] TRIGGER mid = ${messageID}`)
|
||||||
fn(...rest)
|
fn(...rest)
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in a new issue