3 ms·
> The API is rate limited, so we created a set of Node.js Azure Functions that ran on a timers. These functions would request as many tweets as they could befor
by mcintyre1994 8y ago
> The API is rate limited, so we created a set of Node.js Azure Functions that ran on a timers. These functions would request as many tweets as they could before they were rate limited, wait for the timeout interval specified by the API docs, then resume processing where they left off.
How does this work? You pay for your function's run time in serverless so you wouldn't want to just have the function sleep for x minutes or however long it gets rate limited surely. I can see a way to do it using a service bus queue (push the message with a delay of x minutes, have the function set up to run on messages on that queue) but they specifically said timers. Does Azure let you programatically set the timer for a function from inside that function (eg. "Run me again in 3 minutes")?
- raudabaugh 8y agoAzure Functions can be configured to run on fixed schedules via timer triggers (https://docs.microsoft.com/en-us/azure/azure-functions/functions-bindings-timer https://docs.microsoft.com/en-us/azure/azure-functions/funct...), so I’m guessing they set theirs to run every API timeout interval + max amount of time they could request tweets before getting rate limited. Their Cosmos DB instance could then be set up to track how many tweets they had gotten through on each function run.