-
-
Notifications
You must be signed in to change notification settings - Fork 11
Open
Labels
Description
const noroutine = require('noroutine');
const module1 = require('./module1.js');
const module2 = require('./module2.js);
noroutine.init({ modules: [module1, module2] });
(async () => {
const res11 = await module1.method1('value1');
const res12 = await module1.method2('value2');
const res22 = await module2.method2('value21');
})();
actual: run one by one in different workers
expected: more suitable example
(async () => {
const res11 = module1.method1('value1');
const res12 = module1.method2('value2');
const res22 = module2.method2('value21');
await res11;
await res12;
await res22;
// or Promise.all
})();
actual: functions run one by one in first worker
expected: functions run in parallel
worker utilization sample for http requests for default options:
actual:1 -----__________-----
2 _____-----__________
3 __________-----_____
4 ____________________
expected:
1 -----------_------_-
2 _----_--------------
3 _-------------_-----
4 --------_-----------
tshemsedinov