Skip to content

Commit

Permalink
Fixed the cancellation timeout equal to -1 (#3723)
Browse files Browse the repository at this point in the history
Fixes #3720

(cherry picked from commit 099a8ef)
  • Loading branch information
vonzshik committed May 11, 2021
1 parent 952f277 commit 93ae9dc
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/Npgsql/NpgsqlConnectionStringBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -940,6 +940,7 @@ public int InternalCommandTimeout

/// <summary>
/// The time to wait (in milliseconds) while trying to read a response for a cancellation request for a timed out or cancelled query, before terminating the attempt and generating an error.
/// Zero for infinity, -1 to skip the wait.
/// Defaults to 2000 milliseconds.
/// </summary>
[Category("Timeouts")]
Expand All @@ -952,8 +953,8 @@ public int CancellationTimeout
get => _cancellationTimeout;
set
{
if (value < 0)
throw new ArgumentOutOfRangeException(nameof(value), value, $"{nameof(CancellationTimeout)} can't be negative");
if (value < -1)
throw new ArgumentOutOfRangeException(nameof(value), value, $"{nameof(CancellationTimeout)} can't less than -1");

_cancellationTimeout = value;
SetValue(nameof(CancellationTimeout), value);
Expand Down

0 comments on commit 93ae9dc

Please sign in to comment.