Skip to content

SignalR client: Incorrect number of failed reconnection attempts in log message #34549

@misha-fm

Description

@misha-fm

When retries number is exhausted, the message, indicating how many attempts were made, is logged:

Log.ReconnectAttemptsExhausted(_logger, previousReconnectAttempts, elapsedTime);

But this value is incorrect, the actual number of attempts is always 1 less, because here

nextRetryDelay = GetNextRetryDelay(previousReconnectAttempts++, DateTime.UtcNow - reconnectStartTime, retryReason);

the value is first sent to the retryPolicy.NextRetryDelay(...) method, and if inside this method the logic checks that the value does not meet the requirements to continue reconnecting, no more retries are executed, but the value previousReconnectAttempts is still incremented after the method returns.

Metadata

Metadata

Labels

area-signalrIncludes: SignalR clients and serversbugThis issue describes a behavior which is not expected - a bug.help wantedUp for grabs. We would accept a PR to help resolve this issue

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions