Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 2a36f89

Browse files
PYTHON-3142 Stop using $where in test_maxConnecting (#886)
(cherry picked from commit 8496ed4)
1 parent 542766e commit 2a36f89

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

‎test/test_pooling.py‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff 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:

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /