Scenario Hack: Preventing Maximum Execution Time & Rate-Limiting (Using Queues)

Hey Guys,

Recently, we encountered a Challenge in one of our Scenarios: We had to use a rather large “Sleep” because one of the Modules in our Scenario (Sending a Mail) had a strong rate limit while also having a large Number of Bundles in the Scenario, resulting in a Scenario excution time longer than the 40 Minutes allowed.

So we created a “Mailer Queue”, that allows us to Queue unlimited amounts of Mails to send keeping our Sleeper while not exceeding the 40 Minutes.

The Structure

So our Mailer Queue consists of 2 Scenarios and one Data-Store.

Scenario 1: Scheduling the Mails
Here we get all the Recipients Data (hundreds of recipients). Then we loop through them, and for every single one of them we first check, if they are already in the “Queue” Data-Store, and if not, we do some Hubspot stuff and then add them to the Queue, including all the Data that we need to send the Mail.

Data Store: The Mailer Queue
In the Data Store we add all the Data that we need to send the Mail. In Our Case, we needed a lot of Information, as we had to also generate a PDF Certificate.

Here we also added a Checkbox “Sent”, to tell us if this Mail was already sent (to not send it again in our Mailing-Scenario). We did this for Testing-Purposes, you can also delete the Data-Store Entry after the Mail is sent.

Scenario 2: The Mailer
This Scenario is Running every 15 Minutes, and every time, getting as many Records from the Data store as we can do in 15 Minutes, including our Sleeper for Rate-Limiting.

The first two modules are there, to save operations and bandwidth: They will stop the Whole scenario if there are no Entries to send in the Data store.

After that, we Download a Certificate Word-Template. Then we get around 70 Entries from the Data store where “Sent” is false (70 Recipients). Then for every recipient, we generate the PDF Certificate and afterwards send the E-Mail. Then, we mark the recipient as “Sent”, so that he will not be retrieved on the next run and do some more Hubspot stuff.


That Way, you can send as many mails as you want, with delays as long as you want to and never exceed the 40 Minutes maximum execution time.

This can also be used for all other kinds of time-intensive tasks, to prevent the maximum execution time.

I though about doing a YouTube-Video about this Topic, explaining it in detail. Would you be interested in that? If yes, leave a comment!

If you need help in your scenarios or have questions, do not hesitate to reach out or comment!


Christoph Gerl
Funkenwerfer Process & CRM-Automation

1 Like

Heya @Funkenwerfer happy Friday :blob_dance:

I just wanted to drop by and say a huge thank you for taking the time to type out such a helpful and detailed guide. It’s clear that you put a lot of effort into it, and I’m certain it’s going to bring a ton of value to the community :clap:

Your willingness to share what you know and therefore contribute to our collective knowledge hub is truly awesome. Thank you :star2: