-
Notifications
You must be signed in to change notification settings - Fork 345
Closed
Labels
area: responsesThis item is related to ResponsesThis item is related to Responsesneeds-author-feedbackWorkflow: More information is needed from author to address the issue.Workflow: More information is needed from author to address the issue.questionCategory: The issue is seeking information about the library or its usage.Category: The issue is seeking information about the library or its usage.
Description
Describe the bug
I'm using AzureOpenAIClient, I've set timeout for streaming response using CancellationTokenSource.CancelAfter. But sometimes the timeout is not happening. The program struck at await foreach (ChatResponseUpdate update in stream.WithCancellation(cts.Token))
Steps to reproduce
Complete code
using var overallCts = new CancellationTokenSource(TimeSpan.FromMinutes(2));
using var cts = CancellationTokenSource.CreateLinkedTokenSource(overallCts.Token, cancellationToken);
cts.CancelAfter(TimeSpan.FromSeconds(45)); // initial timeout of 45 seconds
var stream = client.GetStreamingResponseAsync(messages, options, cts.Token);
await foreach (ChatResponseUpdate update in stream.WithCancellation(cts.Token))
{
cts.CancelAfter(TimeSpan.FromSeconds(15));
// my code
}
Sometimes code struck at await foreach forever. None of the other logs were triggered within the loop or outside the loop. What could be reason?
Code snippets
OS
Azure App Service (Linux)
.NET version
9
Library version
2.3.0-beta.2
Metadata
Metadata
Assignees
Labels
area: responsesThis item is related to ResponsesThis item is related to Responsesneeds-author-feedbackWorkflow: More information is needed from author to address the issue.Workflow: More information is needed from author to address the issue.questionCategory: The issue is seeking information about the library or its usage.Category: The issue is seeking information about the library or its usage.