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
When an async generator wrapped with batchWithTImeout is never "finalized", while batch and naked loop is.
Please see examples below, both "batch" and simple loop prints Loop Finally while batchWithTimeout does not print Loop Finally and continues reading from the stream.
Simple loop:
asyncfunction*generate(){try{for(leti=0;i<20;i++){console.log({ i });yieldi;awaitnewPromise((resolve)=>setTimeout(resolve,10));}console.log("Loop Completed");}catch(err){console.log("Loop Caught error",err);throwerr;}finally{console.log("Loop Finally");}}try{forawait(constiofgenerate()){console.log({ i });if(i===10){console.log("Thrown");thrownewError("Thrown");}}console.log("Global Completed");}catch(err){console.log("Global Caught error",err);throwerr;}finally{console.log("Global Finally");}
The text was updated successfully, but these errors were encountered:
oleg-slapdash
changed the title
When we throw with batchWithTimeout loops keeps dangling.
When we throw with batchWithTimeout loop is not finalized
Jul 5, 2023
When an async generator wrapped with
batchWithTImeout
is never "finalized", whilebatch
and naked loop is.Please see examples below, both "batch" and simple loop prints
Loop Finally
whilebatchWithTimeout
does not printLoop Finally
and continues reading from the stream.Simple loop:
Output
Loop with a batch:
Output
Output
The text was updated successfully, but these errors were encountered: