Run workflows or actions asynchroniously

Running Parallel Workflows for Simultaneous Image Generation in WeWeb

I’ve implemented an image generator that sends requests to a server with 10-15 second response times. My current workflow structure:

  1. Prepares the request
  2. Sends it to the server
  3. Shows the generated image to the user upon response

My requirement: Allow users to generate multiple images simultaneously using the same workflow logic in parallel.

What I’ve tried: I attempted using loops, but discovered they run synchronously (each request only begins after the previous completes), which doesn’t achieve the parallel processing I need.

Technical question: How can I trigger multiple instances of the same workflow to run concurrently in WeWeb? Are there any patterns or techniques to manage parallel execution of identical workflows?

A workflow action itself is aysnc so I would try to have the the workflow action do all the work. How are you preparing the request?

yeah, I know that workflow itself is async, but how do I trigger multiple workflows inside the workflow asynchoniously is the question.

I prepare the request by adding loading animation and transforming data for the request. Nothing special.

You can invoke the workflows via wwLib.wwWorkflow.executeGlobal, this returns a promise which you can await, but it’s pure code. There is no way currently to make it happen in nocode in WeWeb. I’ve done a similar thing for uploading images into Supabase, instead of looping and waiting for each one, I just process them in parallel.

that’s actually very helpful, I’ll try it, thx