We need to create a random delay within the worflow. so Is it possible to add a random delay in the workflows?
No. There is currently no elegant approach to doing this. I’ve proposed a ticket to add some functions to work with random bits.
A few things come to mind if this is absolutely needed:
- use an external API, such as random.org
- write a short automation script to use JS’s
Math
library
If you write down your use case we might be able to find a workaround until this is better supported.
Actually we are doing some calculation within the workflow while data is inserted. So the workflow needs to run synchronously(I mean same workflow shouldnt run in parallel), otherwise we are encountering racecondition.
To solve this issue, the best possible way is to use an external queue and insert the record synchronously but for POC I just wanted to get away with some random delay in the workflow.
An option would be to create a queue
module where your record insertions would create a record within the queue
module via workflow 1.
Then you could use an interval trigger to process the newly inserted data based on the queue
module.