Skip to content

Commit

Permalink
Add default timeout to initial commands (#594)
Browse files Browse the repository at this point in the history
By removing infinite timeout sets the command writing to use
default timeouts. There is a chance, while reconnecting, socket
errors might be causing the re-subscriptions (performed by the
PriorityCommandWriter) to stall. By having a timeout, we should
recover from socket errors happening during re-subscriptions.
  • Loading branch information
mtmk authored Aug 5, 2024
1 parent 8f3135b commit 0ba6500
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/NATS.Client.Core/Commands/PriorityCommandWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ internal sealed class PriorityCommandWriter : IAsyncDisposable

public PriorityCommandWriter(NatsConnection connection, ObjectPool pool, ISocketConnection socketConnection, NatsOpts opts, ConnectionStatsCounter counter, Action<PingCommand> enqueuePing)
{
CommandWriter = new CommandWriter("init", connection, pool, opts, counter, enqueuePing, overrideCommandTimeout: Timeout.InfiniteTimeSpan);
CommandWriter = new CommandWriter("init", connection, pool, opts, counter, enqueuePing);
CommandWriter.Reset(socketConnection);
}

Expand Down

0 comments on commit 0ba6500

Please sign in to comment.