We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 180b865 commit 1c1a150Copy full SHA for 1c1a150
src/MongoDB.Driver/OperationContext.cs
@@ -117,7 +117,13 @@ public OperationContext Fork() =>
117
RootContext = RootContext
118
};
119
120
- public bool IsTimedOut() => RemainingTimeout == TimeSpan.Zero;
+ public bool IsTimedOut()
121
+ {
122
+ // Dotnet APIs like task.WaitAsync truncating the timeout to milliseconds.
123
+ // We should truncate the remaining timeout to the milliseconds, in order to maintain the consistent state:
124
+ // if operationContext.WaitTaskAsync() failed with TimeoutException, we want IsTimedOut() returns true.
125
+ return (int)RemainingTimeout.TotalMilliseconds == 0;
126
+ }
127
128
public bool IsCancelledOrTimedOut() => IsTimedOut() || CancellationToken.IsCancellationRequested;
129
0 commit comments