Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions packages/pic/src/pocket-ic-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -350,8 +350,9 @@ export class PocketIcClient {
return decodeIngressStatusResponse(res);
}

public async awaitCall(
public async awaitCallWithRounds(
req: AwaitCanisterCallRequest,
rounds: number,
): Promise<AwaitCanisterCallResponse> {
this.assertInstanceNotDeleted();
const encodedReq = {
Expand All @@ -361,7 +362,7 @@ export class PocketIcClient {
caller: undefined,
};

for (let i = 0; i < AWAIT_INGRESS_STATUS_ROUNDS; i++) {
for (let i = 0; i < rounds; i++) {
await this.tick();
const result = await this.ingressStatus(encodedReq);
if (isNotNil(result)) {
Expand All @@ -370,10 +371,16 @@ export class PocketIcClient {
}

throw new Error(
`PocketIC did not complete the update call within ${AWAIT_INGRESS_STATUS_ROUNDS} rounds`,
`PocketIC did not complete the update call within ${rounds} rounds`,
);
}

public async awaitCall(
req: AwaitCanisterCallRequest,
): Promise<AwaitCanisterCallResponse> {
return this.awaitCallWithRounds(req, AWAIT_INGRESS_STATUS_ROUNDS);
}

private async post<B, R extends {}>(
endpoint: string,
body?: B,
Expand Down
Loading