'node js api design and waiting for long process excution
I have 2 tables
pin codes - list of pin codes [lets take 5000]
addresses - corresponding addresses-from an API
I want to write an API like '/update-addresses' by using Node Js
After updating the required table API should give response back like 'update done'
above scenario was working fine in my case when i am going with 10 pin codes.
but for 100 or more it's taking too much time to complete. is it will through an error like timed out?
how we can reduce the time for 100 or more pin codes?
algorithm:
fun(res,req){
a=list of pin codes
output=[]
Promise.all(a.map(){
let p=new Promise((resolve)=>{
axios(API call).then(d=>{
resolve(d)
})
})
return p.then(out=>{
output.push(out)
})
}).then(()=>{
res.send(output)
})
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
