I'm in the process of migrating an existing NodeJS application to run as a Lambda function. So far I've identified that the main function which sends an HTTP POST request can be placed into a Lambda function, however, this function is invoked via a For Loop in which after each iteration has a random delay. The For Loop's iteration count is defined by a user request.
The only way I can think of is having a normal NodeJS process that runs the "Loop" which invokes the lambda. But this defeats the purpose of the serverless/auto-scaling architecture I am trying to create.
Am I able to replace the below for loop & random delay with a serverless/auto-scaling solution?
for (let i = 0; i < userTasks; i++) {
httpRequestLambda();
await delay(); // delay can be anywhere from 5 Seconds to 20 Minutes
}
question from:https://stackoverflow.com/questions/65928007/aws-lambda-multiple-invocations-with-a-random-delay