Skip to content

.Net: The operation was cancelled because it exceeded the configured timeout of 0:01:40 #3412

Answered by Alerinos
takeo-iw asked this question in Q&A
Discussion options

You must be logged in to vote

@takeo-iw
I did such a thing, although I have the impression that the 10-minute time is ignored and sometimes I get 1 minute and 20 or 40 seconds.

    public Kernel CreateChatContext(string token, string model)
    {
        var httpClient = new HttpClient
        {
            Timeout = TimeSpan.FromMinutes(10),
        };

        var builder = Kernel.CreateBuilder();

        builder.Services.ConfigureHttpClientDefaults(c =>
        {
            // Use a standard resiliency policy, augmented to retry on 401 Unauthorized, 502 Bad Gateway and on timeout for this example
            c.AddStandardResilienceHandler().Configure(o =>
            {
                // Combine checks for status…

Replies: 1 comment 8 replies

Comment options

You must be logged in to vote
8 replies
@matthewbolanos
Comment options

@Alerinos
Comment options

@takeo-iw
Comment options

@Alerinos
Comment options

Answer selected by takeo-iw
@takeo-iw
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants