File tree 1 file changed +5
-4
lines changed
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):
378
378
def test_maxConnecting (self ):
379
379
client = rs_or_single_client ()
380
380
self .addCleanup (client .close )
381
+ self .client .test .test .insert_one ({})
382
+ self .addCleanup (self .client .test .test .delete_many , {})
381
383
pool = get_pool (client )
382
384
docs = []
383
385
384
386
# Run 50 short running operations
385
387
def find_one ():
386
- docs .append (client .test .test .find_one ({"$where" : delay ( 0.001 ) }))
388
+ docs .append (client .test .test .find_one ({}))
387
389
388
390
threads = [threading .Thread (target = find_one ) for _ in range (50 )]
389
391
for thread in threads :
@@ -394,9 +396,8 @@ def find_one():
394
396
self .assertEqual (len (docs ), 50 )
395
397
self .assertLessEqual (len (pool .sockets ), 50 )
396
398
# 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.
400
401
if client_context .tls and client_context .auth_enabled :
401
402
self .assertLessEqual (len (pool .sockets ), 30 )
402
403
else :
You can’t perform that action at this time.
0 commit comments