AspNetCore.Diagnostics.HealthChecks icon indicating copy to clipboard operation
AspNetCore.Diagnostics.HealthChecks copied to clipboard

AspNetCore.HealthChecks.Uris: AddUrlGroup has timeout parameter but it's not used for the given url.

Open hartmark opened this issue 9 months ago • 1 comments

The method AddUrlGroup has a parameter named timeout, but that is a global timeout for testing all Urls and not the specific Url you're adding.

Suggestion is to rename tiemout to globalTimeout or something more obvious and add a new timeout that you use when creating the items in the function.

Something like this would be good:

                var options = new UriHealthCheckOptions()
                    .AddUri(uri)
                    .UseTimeout(timeout)
                    .UseHttpMethod(httpMethod);

hartmark avatar Feb 28 '25 15:02 hartmark

Quick workaround is to use the AddUrlGroup that has the uriOptions parameter instead of url. And do like this:

                uriOptions: uriOptions =>
                {
                    uriOptions.AddUri(uri);
                    uriOptions.UseTimeout(TimeSpan.FromSeconds(120));
                },

hartmark avatar Feb 28 '25 15:02 hartmark