The node4 lambda function, called through the GW API, makes a sequence of slow API calls. So that users do not wait for the completion of everything, I plan to make my code look like this:
function(event, context, callback) {
...
callback(null, data);
longApiCall().then(otherLongApiCalls)
}
But now I read in AWS docs : "the callback will wait until the Node.js event loop is empty before freezing the process and returning the results to the caller"
Does this mean that the GW API returns response data before or after the completion of longApiCalls?
If after, is there a way to “get back earlier” before it's all over?
bebbi source
share