How to count an limit requests within a timeframe?

Hi dear make.com Community,

i am using a service that limits the number of requests per minute at a maximum of 15 which i want to respect. At multiple points in my scenario i am calling the service.

To solve this i was thinking to do the following:

  • add an increment function to introduce a counter
  • use a “set variable” behind every call to raise the increment function another time
  • check before every call of my variable is at 15
  • if yes, sleep for 60 and set the variable to 0
  • if not, continue

But i can’t make it work that way. Mainly because i struggle to reference the variable in the right way when trying to reset it.

This is how it looks like:

Bildschirm­foto 2024-03-04 um 14.41.28

It seems that when i directly reference my increment variable it uses the value instead of the name which means it uses “15” as a variable name:

Bildschirm­foto 2024-03-04 um 14.53.10

But when i am manually entering “i” which seems to be the name of the variable created and the output is 0 as it should be… (s. Screenshot)

Bildschirm­foto 2024-03-04 um 14.54.14

The increment function sets it back to 15 and continues counting instead of respecting the new value for 0.

How can i solve such a case? Do i need to replace my increment function with something else?

Hi @fruits

Heres a blueprint example
Just make sure that of the array is 0 basis set the mod as 15 and if it’s 1 basis use 16
Sleep.json (12.5 KB)

2 Likes

I will try this asap and follow up. Thanks!