Every X minutes Pull from queue

I just want to know if I did delay for piece correctly.
here’s my flow:

  1. push items to Queue
  2. Delay for: X minutes
  3. Pull 1 item from Queue
  4. Do something.

Would this work if total items in queue are 15 and I want all of them to be published X minutes after each other?

Hello @Synovve , Welcome to the community :wave:,

You can use the Loop piece to iterate over all 15 items and add a delay step inside the loop, as shown in the image.

What would be custom code here @kishanprmr ?

This custom code is for performing any additional actions on queue items if the use case requires it.

@kishanprmr

Ok so I’ll try to clarify my problem. It’s slightly more precise. In reality, 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.