promsie solves the problem of asynchronous callback nesting, but will the use of promsie cause blocking?
Interface Asynchronous Writing:
app.use("/test",function(req,res){
fn()
}
fn is an asynchronous query database function. Because fn is asynchronous, the code will not wait here. If there are multiple requests at the same time, the next request will not wait for fn to finish execution before accessing the execution. Node can quickly access multiple requests.
write API with async:
app.use("/test",function(req,res){
async fn(){
let res=await fn1()
let res1=await fn2(res)
res.send(res1)
}
fn()
}
at this time, the fn becomes Synchronize, and the next request must wait for the previous request to be processed before it is accessed. If there are too many requests, will it cause blocking, resulting in a long waiting time for later requests? At present, many people use promsie to write encapsulation interfaces, will it cause the above problems? Or do I misunderstand?