Skip to content

Commit 69a2d17

Browse files
committed
ci: setupPeer per chain in parallel
1 parent a80ba8a commit 69a2d17

File tree

1 file changed

+28
-23
lines changed

1 file changed

+28
-23
lines changed

sdk/__tests__/utils.ts

Lines changed: 28 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -140,29 +140,34 @@ export async function link(chainInfos: Ctx[]) {
140140
const registrations: [string, string, VAA<"Ntt:TransceiverRegistration">][] =
141141
[];
142142

143-
for (const targetInfo of chainInfos) {
144-
const toRegister = chainInfos.filter(
145-
(peerInfo) => peerInfo.context.chain !== targetInfo.context.chain
146-
);
147-
148-
console.log(
149-
"Registering peers for ",
150-
targetInfo.context.chain,
151-
": ",
152-
toRegister.map((x) => x.context.chain)
153-
);
154-
155-
for (const peerInfo of toRegister) {
156-
const vaa = await setupPeer(targetInfo, peerInfo);
157-
if (!vaa) throw new Error("No VAA found");
158-
// Add to registrations by PEER chain so we can register hub first
159-
registrations.push([
160-
targetInfo.context.chain,
161-
peerInfo.context.chain,
162-
vaa,
163-
]);
164-
}
165-
}
143+
// register each chain in parallel
144+
await Promise.all(
145+
chainInfos.map((targetInfo) =>
146+
(async () => {
147+
const toRegister = chainInfos.filter(
148+
(peerInfo) => peerInfo.context.chain !== targetInfo.context.chain
149+
);
150+
151+
console.log(
152+
"Registering peers for ",
153+
targetInfo.context.chain,
154+
": ",
155+
toRegister.map((x) => x.context.chain)
156+
);
157+
158+
for (const peerInfo of toRegister) {
159+
const vaa = await setupPeer(targetInfo, peerInfo);
160+
if (!vaa) throw new Error("No VAA found");
161+
// Add to registrations by PEER chain so we can register hub first
162+
registrations.push([
163+
targetInfo.context.chain,
164+
peerInfo.context.chain,
165+
vaa,
166+
]);
167+
}
168+
})()
169+
)
170+
);
166171

167172
// Push Hub to Spoke registrations
168173
const hubToSpokeRegistrations = registrations.filter(

0 commit comments

Comments
 (0)