I am currently building a project based on Meteor. Basically the interface make several calls to the Google API. The problem is when I load the interface, all elements of the interface make simultaneous calls to the Google API, which then fails because of the rate limit of Google.
My question is how to limit the rate of these calls, or maybe queue these calls so they don’t get executed at the same time? I saw this:
edit: if you want to set up a queue, you could attach a cache object to a wrapper around some sort of throttling mechansim. if the function is called push it onto the queue list. have the wrapper pop functions off the top of the stack, and then call them. if !stack, then dont do any thing.
basically, you could re-write that library by doing the above
@mspi has the right approach to this. However, if you need additional delay between (synchronous) calls, you can make use of a timer. How many is “several”?