Record Nodejs Problems encountered in asynchrony
You need to place the order first id Find out , Then according to the order id Check order details
public async queryOrder() {
const sql = `select id, total from tbl_orderlines`;
const res = await this.app.mysql.query(sql);
const { ctx } = this;
async function awaitTest() {
// Apply to promise.all Method , In turn map Got promise Get value
await Promise.all(res.map(async item => {
item.orderlines = await ctx.service.test.queryDetails(item.id);
return item;
}));
}
await awaitTest();
return res;
}


![[real case] trap of program design - beware of large data](/img/bd/d72cc5ce23756cea873c9ced6b642a.jpg)



![[cloud native topic -49]:kubesphere cloud Governance - operation - step by step deployment of microservice based business applications - basic processes and steps](/img/af/58fbc51000cdc39de80e7c10e5b099.jpg)

