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
If mapper returns a native promise, map() may continue to call mappers after cancellation main promise. This should not happen because concurrency is used (all mappers do not have time to start):
Promise.config({cancellation: true});functiontest(){letarray_size=100;letcount=0;lettask=Promise.map(newArray(array_size),async()=>{count++;if(count===array_size)console.log('all handlers were called');returnPromise.delay(10);},{concurrency: 10})setTimeout(()=>{task.cancel();},10);}lettests_count=100;while(tests_count--){test();}
The console output:
all handlers were called
all handlers were called
...
This is a heisenbug, I can not reproduce it in its pure form without understanding the source code.
Correct behavior without native promises:
Promise.config({cancellation: true});functiontest(){letarray_size=100;letcount=0;lettask=Promise.map(newArray(array_size),()=>{count++;if(count===array_size)console.log('all handlers were called');returnPromise.delay(10);},{concurrency: 10})setTimeout(()=>{task.cancel();},10);}lettests_count=100;while(tests_count--){test();}
Сonsole is empty.
in this situation, in theory, it does not matter which promise is returned by the mapper, so this behavior is not obvious to me.
I use a translator, sorry
The text was updated successfully, but these errors were encountered:
bluebird version: 3.7.1
Node.js 10.16.0
in bluebird 3.5.3 same to
If mapper returns a native promise, map() may continue to call mappers after cancellation main promise. This should not happen because concurrency is used (all mappers do not have time to start):
The console output:
This is a heisenbug, I can not reproduce it in its pure form without understanding the source code.
Correct behavior without native promises:
Сonsole is empty.
in this situation, in theory, it does not matter which promise is returned by the mapper, so this behavior is not obvious to me.
I use a translator, sorry
The text was updated successfully, but these errors were encountered: