File tree 4 files changed +18
-7
lines changed
4 files changed +18
-7
lines changed Original file line number Diff line number Diff line change @@ -356,9 +356,7 @@ private void HandleException(Exception ex)
356
356
throw new MongoInternalException ( "Invalid HandleExceptionAction" ) ;
357
357
}
358
358
359
- // forces a call to VerifyState before the next message is sent to this server instance
360
- // this is a bit drastic but at least it's safe (and perhaps we can optimize a bit in the future)
361
- _serverInstance . SetState ( MongoServerState . Unknown ) ;
359
+ _serverInstance . RefreshStateAsSoonAsPossible ( ) ;
362
360
}
363
361
364
362
private enum HandleExceptionAction
Original file line number Diff line number Diff line change @@ -349,6 +349,14 @@ public void Ping()
349
349
}
350
350
}
351
351
352
+ /// <summary>
353
+ /// Refreshes the state as soon as possible.
354
+ /// </summary>
355
+ public void RefreshStateAsSoonAsPossible ( )
356
+ {
357
+ _stateVerificationTimer . Change ( TimeSpan . Zero , TimeSpan . FromSeconds ( 10 ) ) ; // verify state as soon as possible
358
+ }
359
+
352
360
/// <summary>
353
361
/// Verifies the state of the server instance.
354
362
/// </summary>
Original file line number Diff line number Diff line change @@ -37,10 +37,6 @@ public enum MongoServerState
37
37
/// </summary>
38
38
ConnectedToSubset ,
39
39
/// <summary>
40
- /// The state is temporarily unknown.
41
- /// </summary>
42
- Unknown ,
43
- /// <summary>
44
40
/// Disconnecting from the server (in progress).
45
41
/// </summary>
46
42
Disconnecting
Original file line number Diff line number Diff line change @@ -115,6 +115,15 @@ public IEnumerator<TDocument> Execute(IConnectionProvider connectionProvider)
115
115
}
116
116
}
117
117
}
118
+ catch
119
+ {
120
+ if ( reply != null && reply . CursorId != 0 )
121
+ {
122
+ try { KillCursor ( connectionProvider , reply . CursorId ) ; }
123
+ catch { } // ignore exceptions and rethrow the original exception
124
+ }
125
+ throw ;
126
+ }
118
127
finally
119
128
{
120
129
if ( reply != null && reply . CursorId != 0 )
You can’t perform that action at this time.
0 commit comments