Dealing with zaps that trigger multiple time simultaneously with random time delays

  • 24 September 2019
  • 22 replies
  • 8436 views

Userlevel 7
Badge +10

Non-instant trigger zaps poll their respective APIs once every 5 or 15 minutes depending what Zapier plan you're on.

When multiple new items are found, this results in multiple zap runs triggering at the same time.

This is often fine, but occasionally other apps in your zap might not be able to handle being inundated by new data all at the same time, causing zap errors.

This happened with two clients of mine:

  • The first has a Shopify store that at peak times can receive anything from 5 - 15 orders in a 5 minute period. One of their zaps creates Trello cards for each order and at times Trello would not be able to handle creating so many cards at once and would throw errors.
  • The other had a zap that watches quite a busy RSS feed and sends the articles to Buffer. They found buffer would often throw errors when trying to post multiple articles at once.

Auto-replay for failed zaps is a great feature, but not suitable for everyone - so I looked for a way to space out zap runs.

A simple code step saves the day:

Screen Shot 2019-09-24 at 12.46.38.pngreturn {

 randomNumber: Math.random() * (3 - 1) + 1

};

This generates a random(ish) number

(these bounds can be changes

needed), which

can be fed

a "Delay For" step.

Screen Shot 2019-09-24 at 12.47.15.pngThe result is a zap triggers 10 times at the same time, will find the action steps of each run starting at a slightly different time, hopefully taking pressure off the apps they are sending data to.

If anyone has other ways of doing this - I'd love to discuss 😀




22 replies

Userlevel 7
Badge +8

Hey everyone! I wanted to provide an update on this request from our product and engineering teams:

Unfortunately, our technical backend doesn’t currently support the ability to pinpoint performing an action after a delay to the nearest second which would be necessary for something with a smaller increment than to the nearest minute. We are always working on making this process work faster and more efficiently to potentially offer this level of resolution in the future, but it’s not in the current plans.

Userlevel 7
Badge +11

Hi @GandalfG, thanks for letting us know that you’re interested in a Delay After Queue that allows a delay interval of less than a minute.

 

I've added your email address as another vote for this addition. I don't have an ETA of when or if this will happen, but we will definitely email you if it does become a reality.  Thanks!

Hi !

I got same problems as explained. Delay after Queue option don’t allow under 1 minute delay. Each delay add to each other, while we just need that each Zap will execute one behing the other.

It would really be a huge improvement of Zapier if it could be possible.

At the moment we would need to use external custom code to handle that.

Thanks for the futures development to come :)

Userlevel 7
Badge +11

Hi @ghankihan! If you’re having trouble with too many tasks happening at the same time, then one way of handling that is to add a step in the Zap after the trigger step. For the new step, use the Delay by Zapier app and choose the Delay after Queue option. 

 

If you’re not sure how to do that or if that will help, then could you create a new question in Ask the Community that explains a bit more about what you’re trying to do? The original link that you shared is to a tech website rather than images of the files. It’s often better to copy and paste images into the body of your post so that folks can easily see them 🙂

i am also facing same type of error Now a days, I’m dealing with same type of errors in my account. I’m try to solve it but i don’t understant the technical things with it. Can you guide me about the solution? You can check here some error files.

I use Trello and it does seem to get up to date by using our device in clusters, I even have a bigger degree confidence that the records that ends up on an man or woman Trello card is certainly correct!

Userlevel 2
Badge

This is an incredibly helpful thread! Thank you to everyone!! This thread was able to effectively solve a huge problem I was having with large exports corrupting zap performance. 

In my case, this solution has awesome work for my own site  I've applied it to. But I think I'll try your idea next time to see how it goes.

 I’m trying to solve it but I don’t understand the technical things my website faces some load problem with it. Can you guide me? You can check here some problem files and documents.

Now a days, I’m dealing with same type of errors in my account. I’m try to solve it but i don’t understant the technical things with it. Can you guide me about the solution? You can check here some error files.

Userlevel 7
Badge +11

@mrjcleaver and @edmundkl - we do have a feature request open for the option to add shorter delays. I’ve added you to that request, which let the team know how many users are interested in this feature and also means that you’ll get an email if we have an update on that. 

 

In the meantime, @AndrewJDavison_Luhhu has posted a workaround for this using a code step, which you can check out here: How to create zap delays of less than 1 minute (between 1 - 10 seconds) 

Why is the minimum as much as1 minute? If you have 1500 items to process and the downstream system can handle 5 a second you’ve just extended the processing time from 1500/5 from 300 seconds (5 minutes) to 25 hours.

 

I agree, is there anyway to reduce the minimum delay time to seconds instead of 1 minute?

As I find “Delay After Queue” is useful to ensure I don’t face Race Conditions, however it will snowball/accumulate the delay time as more trigger comes into queue.

Or is there any other method / tools which can buffer/queue the zap triggers?
Example: immediately allow the next in queue zap to be executed after every successful zap cycle.

@AndrewJDavison_Luhhu method may still have a slight possibility of 2 triggers spaced very closely apart which will still cause Race Conditions.
Eg. math.random number generated is 0.001 apart

Userlevel 2
Badge

Why is the minimum as much as1 minute? If you have 1500 items to process and the downstream system can handle 5 a second you’ve just extended the processing time from 1500/5 from 300 seconds (5 minutes) to 25 hours.

 

Userlevel 3

Yes, I agree… I ended up trying this to see how it would work and it works as you outlined it, which gives lots of options on creating some (using your traffic metaphor) interesting diversions as well as multiple delays for various paths!  Since I use Trello and it does seem to get updated by our system in clusters, I have a larger degree of confidence that the data that ends up on an individual Trello card is actually accurate!

And @AndrewJDavison_Luhhu’s original code makes it all even better!

 

Userlevel 7
Badge +11

Now a question:  Does the Queued delay persist across Paths?

 

Broadly speaking, that depends where in the Zap the Delay after Queue step is added. If it’s before the ‘fork’, then yes it will - the Zap will hold the queue and release items as appropriate, which will then travel down their respective paths. 

 

If you want the items to be held in the same queue, but after the ‘fork’ the great thing about the Delay after queue step allows you to create a specific queue so you can use the same queue for each path, but when the item is release, it will continue on the path it was on - does that make sense? Sort of like a traffic light system :) 

Userlevel 3

I know I’m six months late to appreciating this solution - my application doesn’t have a high volume of triggers. Still, it does depend on accurate info being recovered from the Storage by Zapier containers, which I’ve been using more of recently.  Plus the whole ‘Delay After Queue’ function opens up some actions I hadn’t thought to do through Zapier.

Best of all, I’m no expert at coding, so this may be simple, but it sure feels elegant!

Now a question:  Does the Queued delay persist across Paths?

 

Userlevel 7
Badge +10

@jesse Good to know! Thanks.


Userlevel 7
Badge +8

Hey @Luhhu just chiming in for Danvers here! Yes, the longest delay length is 1 month so to answer your earlier question, if you set the queue conditions to 1 week and your Zap Triggered 5 times, only 4 would go through and the last one would produce the following error: "Dates cannot be more than a month in the future"


Userlevel 3

Been using the zapier delay with queue step for a while now. Had a client who does a lot with Trello and a ton of their stuff was failing as it was all triggering at midnight on the day it was set, after doing the 1 minute queue and putting the delay name the same on all the zaps, they all run. Better than the 'Rate Limit Exceeded' error he was getting before!

I guess if you know it's gonna be max 20-50 items and it triggers at non-critical times then it works perfectly. If you have some more tight deadlines then doing something with code / AWS to do delays less than a minute would work better.


Userlevel 7
Badge +10

Hi @John4man_Metagrate - that's a very neat idea!

In my case, this solution has worked perfectly for the client's I've applied it to. But I think I'll try your idea next time to see how it goes.

You could definitely cycle between the queues, although this would add more steps, but would have the added benefit of you being able to control the order of output from the queue somewhat. With my random number idea, you've got way of knowing what order they'll move forward in... which can be problematic for some use cases.


Userlevel 3
Badge

Hi @Luhhu (and @Danvers) --

My first reaction was also Delay after Queue, but after thinking about it more, I'm not absolutely sure. @Luhhu , do you have a way to confirm the success rate? If it looks like you're consistently getting 100% during high volume times, you're probably in an "if it ain't broke don't fix it situation."

If not, I think you may be able to combine these 2 strategies... and this is speculation, you'd have to try it out to see how well it works.

Let's say you want to throttle at 3 per minute. If you generate a random integer between 1 and 3, you would then use Delay by Zapier, specify Queue Title as something like "Buffer Items Queue {{randomInteger}}" , delayed 1 minute. Since you have 3 queues each delayed a minute, at most 3 per minute go through.

However, using a random number would result in uneven queues, but I presume you could keep cycling between 1, 2 and 3 leveraging Storage by Zapier (unless there's a better way that doesn't occur to me.)

Good luck!


Userlevel 7
Badge +10

Hi @Danvers

Love it! I'll have to give this a test.

I suppose this is great up until a certain amount of items are entering the queue. For a handful, fine, but what if 20 items enter the queue - even at a 1 min delay interval, it will be 20 before everything makes it out. With my solution I guess you get control over the maximum amount time it will take everything to get through.

Also how does the 1 month maximum delay play in here? Say I set the interval time to 1 week and then 5 items entered the queue - would the last item never make it out because total delay time exceeds 1 month?


Userlevel 7
Badge +11

Hi @Luhhu!

That is an ingenious solution 🙂

We do now have an option in Delay by Zapier that will handle this for you: Delay after queue

Delay after queue allows you to create a queue of actions and you can set the time that you want each item to wait before setting off:

image.pngIn the example above, I've created a queue called 'Buffer Items' and anything that goes into that queue has to wait 3 minutes after the last item was released before it can pass through the delay and onto the actions.


I like to imagine a Zapier lifeguard, holding trigger items at the the top of a water slide to make sure that everyone gets down safely 😆

From what you've described, it sounds like that would solve the issue that your clients were running into - is that right?


Reply