File tree Expand file tree Collapse file tree 2 files changed +17
-3
lines changed
tests/MongoDB.Driver.TestHelpers Expand file tree Collapse file tree 2 files changed +17
-3
lines changed Original file line number Diff line number Diff line change 2929using MongoDB . Driver . Core . Operations ;
3030using MongoDB . Driver . Core . Servers ;
3131using MongoDB . Driver . Core . WireProtocol . Messages . Encoders ;
32- using MongoDB . Driver . Encryption ;
3332using MongoDB . Driver . TestHelpers ;
3433using Xunit . Sdk ;
3534
@@ -127,7 +126,16 @@ public static ClusterBuilder ConfigureCluster(ClusterBuilder builder)
127126 {
128127 builder = builder
129128 . ConfigureWithConnectionString ( __connectionString . Value , __serverApi . Value )
130- . ConfigureCluster ( c => c . With ( serverSelectionTimeout : __defaultServerSelectionTimeout . Value ) ) ;
129+ . ConfigureCluster ( c => c . With ( serverSelectionTimeout : __defaultServerSelectionTimeout . Value ) )
130+ . ConfigureServer ( s =>
131+ {
132+ if ( Debugger . IsAttached )
133+ {
134+ s = s . With ( heartbeatTimeout : TimeSpan . FromDays ( 1 ) , serverMonitoringMode : ServerMonitoringMode . Poll ) ;
135+ }
136+
137+ return s ;
138+ } ) ; ;
131139
132140 if ( __connectionString . Value . Tls . HasValue &&
133141 __connectionString . Value . Tls . Value &&
Original file line number Diff line number Diff line change 2424using MongoDB . Driver . Core . Clusters ;
2525using MongoDB . Driver . Core . Configuration ;
2626using MongoDB . Driver . Core . Connections ;
27- using MongoDB . Driver . Core . Logging ;
2827using MongoDB . Driver . Core . Servers ;
2928using MongoDB . Driver . Encryption ;
3029
@@ -184,6 +183,13 @@ public static MongoClientSettings GetClientSettings()
184183 {
185184 serverSelectionTimeoutString = "30000" ;
186185 }
186+
187+ if ( System . Diagnostics . Debugger . IsAttached )
188+ {
189+ clientSettings . HeartbeatTimeout = TimeSpan . FromDays ( 1 ) ;
190+ clientSettings . ServerMonitoringMode = ServerMonitoringMode . Poll ;
191+ }
192+
187193 clientSettings . ServerSelectionTimeout = TimeSpan . FromMilliseconds ( int . Parse ( serverSelectionTimeoutString ) ) ;
188194 clientSettings . ClusterConfigurator = cb => CoreTestConfiguration . ConfigureLogging ( cb ) ;
189195 clientSettings . ServerApi = CoreTestConfiguration . ServerApi ;
You can’t perform that action at this time.
0 commit comments