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; _++)