Skip to content

Commit 76f7f42

Browse files
committed
cloud_functions: await everything
1 parent 33b4462 commit 76f7f42

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

cloud_functions/src/getReobserveVaas.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ export async function getReobserveVaas(req: any, res: any) {
3030
res.sendStatus(500);
3131
}
3232
let reobs: ReobserveInfo[] = [];
33-
reobsMap.forEach(async (vaa) => {
33+
const vaaArray = Array.from(reobsMap.values());
34+
const promises = vaaArray.map(async (vaa) => {
3435
let push: boolean = true;
3536
if (vaa.chain === CHAIN_ID_SOLANA) {
3637
const origTxHash = vaa.txhash;
@@ -45,6 +46,7 @@ export async function getReobserveVaas(req: any, res: any) {
4546
reobs.push(vaa);
4647
}
4748
});
49+
await Promise.all(promises);
4850
res.status(200).send(JSON.stringify(reobs));
4951
return;
5052
}

0 commit comments

Comments
 (0)