Wappler 5.0.3
NodeJS
Request took 2 seconds instead of 1. The Wait steps were supposed to run in parallel, right? It looks like they’re running sequentially
Edit: My debugging attempt revealed the following:
options.exec
is not an array, look:
{
steps: [
{
name: '',
module: 'core',
action: 'group',
options: [Object],
output: true
},
{
name: '',
module: 'core',
action: 'group',
options: [Object],
output: true
}
]
}
It’s an object that contains the element “steps”, which is an array
My fix that seems to work, but Patrick needs to double-check:
parallel: async function(options, name) {
var data = {};
if (name) {
let parentData = this.data;
this.data = {};
if (Array.isArray(options.exec.steps)) {
await Promise.all(options.exec.steps.map(exec => this.exec(exec, true)));
} else {
await this.exec(options.exec, true);
}
data = this.data;
this.data = parentData;
} else {
if (Array.isArray(options.exec)) {
await Promise.all(options.exec.map(exec => this.exec(exec, true)));
} else {
await this.exec(options.exec, true);
}
}
return data;
},