Limit/queue calls to Google API



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:

But it seems deprecated, can’t install it. Any help would be appreciated. Thanks!


How about do the calls from the server in a synced call. The server method itself will be async, but your calls to Google will be nice in order.


check out the _.throttle and _.debounce functions in underscore, a package required for all meteor apps.

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”?