I am having the same experience!
In my case, I have a workflow that calls other workflows in an attempt to mimic a for-loop.
If I run the loop with the recommended code the workflow timeouts, but that is understandable because the other workflows it triggers can take long time to return.
Thus, I have modified the code to not wait for the calls to return. The goal is to trigger multiple workflows and die right after, while the other workflows are running in the background. When I do that, however, my workflow behaves as described by @xlarry: timeouts with 0 steps completed.
The problem happens because I am not awaiting for the promises, as pipedream requires. If that’s correct, how can I trigger other workflows and not wait for them to finish?
My workflow id is p_RRCDOD7
.
My modified code is this:
import { axios } from "@pipedream/platform";
export default defineComponent({
props: {
await: {
type: "boolean",
label: "Should it await?",
description: "Wait until all processes are finished.",
},
records: {
type: "any",
label: "Records to loop",
description: "The array of records to send to processing workflow",
},
limit: {
type: "integer",
optional: true,
label: "Limit of records",
description:
"The max amount of records to send to the processing workflow",
},
workflow_url: {
type: "string",
label: "Processing workflow URL",
description:
"The HTTP endpoint to connect to that's processing single individual records from this workflow",
},
},
async run({ steps, $ }) {
const calls = (
this.limit ? this.records.slice(0, this.limit) : this.records
).map((record) =>
axios($, {
url: this.workflow_url,
method: "POST",
data: record,
})
);
console.log(`${calls.length} call(s) made to ${this.workflow_url}`);
if (this.await) {
await Promise.all(calls);
} else {
$.flow.exit(`Workflow will continue processing in the background`);
}
},
});