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
Expected behavior
Should call the function 10 times.
Instead, only one call gets through and all 10 function calls receive copies of the 1st result (possibly because of cache or some kind of protection)
if counter_add returns the current count, then we will receive [1,1,1,1,1,1,1,1,1,1]
I stumbled upon that behavior like 3-4 times and I thought the problem was in my canisters or js.
If we add a 1ms delay, it works as expected
await Promise.all(Array(10).fill(0).map(async x => {
await delay(1);
return canister.counter_add()
}))
This will result in something like [1,2,5,4,3,6,7,8,9,10]
The text was updated successfully, but these errors were encountered:
I wonder if the JS agent uses the “nonce” in the IC request to make these requests actually different (if they get the same timestamp in the expiry field). And judging from the recently merged PR #554 the answer is no, and the solution is already on master.
Describe the bug
Unexpected behavior when calling the same canister function multiple times asynchronously.
To Reproduce
Where
canister
was created with AgentExpected behavior
Should call the function 10 times.
Instead, only one call gets through and all 10 function calls receive copies of the 1st result (possibly because of cache or some kind of protection)
if
counter_add
returns the current count, then we will receive [1,1,1,1,1,1,1,1,1,1]I stumbled upon that behavior like 3-4 times and I thought the problem was in my canisters or js.
If we add a 1ms delay, it works as expected
This will result in something like [1,2,5,4,3,6,7,8,9,10]
The text was updated successfully, but these errors were encountered: