From bee9f0a2ad4fc7087f61654dc42321684558d703 Mon Sep 17 00:00:00 2001 From: Andre Hofmeister <9199345+HofmeisterAn@users.noreply.github.com> Date: Wed, 6 Dec 2023 17:40:59 +0100 Subject: [PATCH] docs: Add RetryHandler remarks --- src/Testcontainers.Couchbase/CouchbaseBuilder.cs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/Testcontainers.Couchbase/CouchbaseBuilder.cs b/src/Testcontainers.Couchbase/CouchbaseBuilder.cs index 344b55b7a..c89968f11 100644 --- a/src/Testcontainers.Couchbase/CouchbaseBuilder.cs +++ b/src/Testcontainers.Couchbase/CouchbaseBuilder.cs @@ -541,15 +541,29 @@ public CreateBucketRequest(CouchbaseBucket bucket) } } + /// + /// An HTTP retry handler that sends an HTTP request until it succeeds. + /// + /// + /// Sending an HTTP request to Couchbase's API sometimes fails with the following + /// error: System.Net.Http.HttpIOException: The response ended prematurely (ResponseEnded). + /// The HTTP status code 504 indicates an issue with the Couchbase backend. + /// It is likely that the API is not yet ready to process HTTP requests. + /// Typically, trying it again resolves the issue. + /// private sealed class RetryHandler : DelegatingHandler { private const int MaxRetries = 5; + /// + /// Initializes a new instance of the class. + /// public RetryHandler() : base(new HttpClientHandler()) { } + /// protected override async Task SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) { for (var _ = 0; _ < MaxRetries; _++)