You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hypothesis for how this occurs:
outbound.deliver(<1>) -> Promise 1 is created -> request for promise 1 is kicked off
outbound.deliver(<2>) -> Promise 2 is created -> request for promise 2 is kicked off
rest api call for promise 1 is received -> stateful emitter emits 'resolve'
Both promises are listening to the same emitter, so both promises resolve with the same response
I think this issue could be avoided by either
Moving away from callbacks, and leaning into promises/async await so that an emitter is not needed in order to resolve the promises, and the emitter state causing the bug is removed
Add additional state to the emitter and have it resolve/reject with a specific key unique to each call of outbound deliver, either by using the timestamp at call time of outbound.deliver, as the calls are guaranteed to happen sequentially even if the promises resolve concurrently.
Create a new emitter for each instance of calling outbound.deliver, and pass that down into the deliver files method
The text was updated successfully, but these errors were encountered:
leads to log
I believe that the root cause for this is the way promises are resolved statefully via event emission in the delivery class.
Hypothesis for how this occurs:
outbound.deliver(<1>) -> Promise 1 is created -> request for promise 1 is kicked off
outbound.deliver(<2>) -> Promise 2 is created -> request for promise 2 is kicked off
rest api call for promise 1 is received -> stateful emitter emits 'resolve'
Both promises are listening to the same emitter, so both promises resolve with the same response
I think this issue could be avoided by either
The text was updated successfully, but these errors were encountered: