Will running promises and immediately sending response in express block anything?

Viewed 125

I just read this great SO question & answer about how doing async/await will not block a thread: Will async/await block a thread node.js

I wanted to sanity check something when doing this in the context of Express.js.

Will the following code block any process and/or will express let runAsyncMethodThatReturnsPromise complete in the background:

const myEndpoint = async(req, res) => {
  const users = await DB.getSomeUsers();
  users.forEach(user => {
    user.runAsyncMethodThatReturnsPromise();
  });

  res.send('Ok');
}
0 Answers
Related