File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -378,12 +378,14 @@ def test_checkout_more_than_max_pool_size(self):
378378 def test_maxConnecting (self ):
379379 client = rs_or_single_client ()
380380 self .addCleanup (client .close )
381+ self .client .test .test .insert_one ({})
382+ self .addCleanup (self .client .test .test .delete_many , {})
381383 pool = get_pool (client )
382384 docs = []
383385
384386 # Run 50 short running operations
385387 def find_one ():
386- docs .append (client .test .test .find_one ({"$where" : delay ( 0.001 ) }))
388+ docs .append (client .test .test .find_one ({}))
387389
388390 threads = [threading .Thread (target = find_one ) for _ in range (50 )]
389391 for thread in threads :
@@ -394,9 +396,8 @@ def find_one():
394396 self .assertEqual (len (docs ), 50 )
395397 self .assertLessEqual (len (pool .sockets ), 50 )
396398 # TLS and auth make connection establishment more expensive than
397- # the artificially delayed query which leads to more threads
398- # hitting maxConnecting. The end result is fewer total connections
399- # and better latency.
399+ # the query which leads to more threads hitting maxConnecting.
400+ # The end result is fewer total connections and better latency.
400401 if client_context .tls and client_context .auth_enabled :
401402 self .assertLessEqual (len (pool .sockets ), 30 )
402403 else :
You can’t perform that action at this time.
0 commit comments