Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

V3 call #137

Merged
merged 5 commits into from
Nov 5, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Adding Wait on 202 of v3 calls
  • Loading branch information
Gekctek committed Nov 5, 2024
commit 6b197a258a57b7688237439289ade00a9fc2cf46
11 changes: 5 additions & 6 deletions src/Agent/Agents/HttpAgent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,11 @@ public async Task<CandidArg> CallAsync(
this.v3CallSupported = false;
return await this.CallAsynchronousAndWaitAsync(canisterId, method, arg, effectiveCanisterId, cancellationToken);
}
// TODO
// if (httpResponse.StatusCode == System.Net.HttpStatusCode.Accepted){
// // If request takes too long, then it will return 202 Accepted
// // and polling is required
// return await this.WaitAsync();
// }
if (httpResponse.StatusCode == System.Net.HttpStatusCode.Accepted)
{
// If request takes too long, then it will return 202 Accepted and polling is required
return await this.WaitForRequestAsync(canisterId, requestId, cancellationToken);
}
await httpResponse.ThrowIfErrorAsync();

byte[] cborBytes = await httpResponse.GetContentAsync();
Expand Down
2 changes: 1 addition & 1 deletion src/Agent/Agents/IAgent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ public static async Task<CandidArg> CallAsynchronousAndWaitAsync(
Principal? effectiveCanisterId = null,
CancellationToken? cancellationToken = null)
{
RequestId id = await agent.CallAsync(canisterId, method, arg, effectiveCanisterId);
RequestId id = await agent.CallAsynchronousAsync(canisterId, method, arg, effectiveCanisterId);
return await agent.WaitForRequestAsync(canisterId, id, cancellationToken);
}

Expand Down