securesauce / precaution-beta

Precaution provides a simple, automated code review for GitHub projects by running code linters with a security focus on pull requests.
Other
1 stars 0 forks source link

Remove redundant async keyword #207

Closed MVrachev closed 5 years ago

MVrachev commented 5 years ago

Nodejs is single threaded but uses an event loop for Asynchronous calls. It has an async/await mechanism which should be used when we have external service or when we need to wait for a data (and we don't have immediate access to it).

Practically that translates to the simple idea that if we are calling one function that is async or if it returns a Promise then we need to await the result of that function and thus use our own async function.

Signed-off-by: Martin Vrachev mvrachev@vmware.com

MVrachev commented 5 years ago

I am sorry that I added the async keyword on soo many instances here: https://github.com/vmware/precaution/commit/ce8e0dca10e18b69640d3852f071b7cc250ece68 and now I had to remove them. At least now we have better knowledge about when and how to use the async/await keywords.