Answer the question
In order to leave comments, you need to log in
Will clients be served in Node if one of the clients is waiting?
Hello! Please tell me how node will behave in this case.
There is a telegram bot and at a certain moment, such a function is performed.
module.exports = async function (bot, message) {
await new Promise(resolve => setTimeout(resolve, 4000));
}
Answer the question
In order to leave comments, you need to log in
Yes, other clients will be served.
The node is single-threaded, but setTimeout does not block the thread. Now, if you count something in this thread for all these four seconds, then the Node will not be able to answer another request, because it will be busy.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question