I am trying to invoke a function (http triggered) in a function as follows:
exports.myFunction = async (req, res) => {
rp(settings); //request-promise library; calling myFunction
await new Promise((resolve) => setTimeout(resolve, 5000));
res.send()
}
I feel this is not a good approach, my considerations are:
- I am not waiting for rp to complete because I do not need the response from it.
- I am awaiting 5 seconds in order to insure the request was fired.
is there a better approach?