Open marcelomorgado opened 5 years ago
For now, a call will be ignored if has another call running.
Is this explicitly enforced in our code, or is this the default behavior?
@pcowgill commented:
Is the non-determinism mostly for tests where the listener is added before or after sending the tx? Or is it a little of both?
We're sure it's not just getting called again with another confirmation for each instantaneous block, right? If so, we could probably disable that in our code and check number of confirmations on each listener call. Or something like that.
For now, a call will be ignored if has another call running.
Is this explicitly enforced in our code, or is this the default behavior?
Is this explicitly enforced in our code:
From Subscription class:
const listener = async (...args) => {
const eventListener = this.#eventListeners.get(eventName);
const { isRunning } = eventListener;
if (isRunning) {
console.info(`Listener is already running`);
return;
}
this.#decorateEventListener(eventName, { isRunning: true });
await baseListener(...args);
this.#decorateEventListener(eventName, { isRunning: false });
};
Got it - thanks
On the development environment, are being called simultaneously and resulting in unexpected behaviors. Actually, blocks are being mined so shortly that a listener for a block is being called before of the call from the last block. For now, a call will be ignored if has another call running. Comment extracted from:
tasit-action
>Action.js
>#addConfirmationListener
:Extracted from: https://github.com/tasitlabs/TasitSDK/pull/369#discussion_r280218408