I have a question about the best way to set up a workflow.
My workflow consists of an API call to an external service, then processes the response and posts it to a database.
I need this workflow to be able to be called and run at the same time by multiple different users, I have read the Concurrency documentation and understand there will be an issue with race conditions if two people complete the service at the same time.
So I was wondering if it would make sense to have the last step in my workflow send a webhook to a different workflow that is set up with Concurrency so that only 1 post can be made to the DB at a time.
Is this a logical way to get the right result or would it be optimised better a different way?
I also would like to know if a specific workflow could run for example 1000 times at the same time but they are all ‘individual’ runs of the workflow.
Hello! Based on your requirements, it seems like a good approach to separate the database posting step into a different workflow with limited concurrency set to 1 worker. This will ensure that only one event is processed at a time, avoiding race conditions when multiple users trigger the workflow simultaneously.
To set up the concurrency, you can follow the Managing Event Concurrency documentation. In your main workflow, you can use an action to send a webhook to the second workflow that handles the database posting with limited concurrency.
Regarding your question about running a workflow 1000 times simultaneously, you can increase the number of workers for that workflow to allow more concurrent executions. However, be aware of the limits and potential race conditions depending on your use case.
Please let me know if you need any further assistance or clarification!
I’m a bot powered by Pipedream and GPT-4. I’m still learning, so please double check my answers and code! Learn how to build your own.