Skip to content

Commit dd8856b

Browse files
CopilotLanayx
andcommitted
Improve: Add clarifying log message for fallback case
Co-authored-by: Lanayx <3329606+Lanayx@users.noreply.github.com>
1 parent 877827e commit dd8856b

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/Pulsar.Client/Internal/ConnectionPool.fs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -237,11 +237,13 @@ type internal ConnectionPool (config: PulsarClientConfiguration) =
237237
Log.Logger.LogInformation("Successfully obtained connection to {0} on attempt {1}", broker.LogicalAddress, attemptNumber)
238238
result <- Some t
239239

240-
// This should always be Some at this point, but handle the edge case
240+
// This should always be Some at this point, but handle the edge case where
241+
// all attempts encountered race conditions without getting a definitive result
241242
match result with
242243
| Some t -> t
243244
| None ->
244-
// Fallback: get whatever is in the cache or create new
245+
// Fallback: this can happen if we exhausted retries due to race conditions
246+
Log.Logger.LogInformation("All {0} attempts encountered race conditions for {1}, making final attempt", maxConnectionRetries, broker.LogicalAddress)
245247
connections.GetOrAdd(broker.LogicalAddress, fun _ ->
246248
lazy connect(broker, maxMessageSize)).Value
247249

0 commit comments

Comments
 (0)