I want to regulate the flow of my stripe events that I receive in a webhook.
It looks like a traffic light. If a single event arrives in the space of a minute, then no problem, I let the flow run. But if two events arrive too close together, say in less than a minute, I don’t want the activepieces flow to be triggered until it has completed its execution on the first event.
As I understand it, in this case I have to create two flows and use a locking key with storage. The first flow has a router which will only store in the queue if the flow is already running. The second flow executes the desired processing on the webhook. This second flow is called instantaneously if the last processing took place more than a minute ago, otherwise it is executed with a delay.
Am I summarising the situation correctly? Is this the right strategy? I find it very complicated for a very simple problem: making sure that the flow doesn’t run simultaneously on two events.
Hello @bastien ,
This does seem like the right approach. You might need to check the status or value of the storage key to determine whether the flow is running or completed.
I’ve tried to create a flow for this use case. It might not be a complete solution, but could you try testing it and see if it works when multiple runs happen simultaneously?
1 Like
Can you share it not as a picture but as a flow I can duplicate so that I get the custom code and how you set each piece @kishanprmr ?
You can use this. I only added the code snippet for the placeholder. You can add the steps required for your use case to further process the trigger data.
thank you very much @kishanprmr . It’s not bad, it helps me a lot it’s a good start but ideally I’d like to avoid having to choose an arbitrary delay and that’s why I was thinking of a Queue system with Queue.
So I wanted to understand a little better how to go about it, I think you need a regulation flow hat with Queue that calls on a data update/creation subflow.
Am I right? How would you go about this flow hat with Queue and the same storage technique you’ve just shown me?