|
46 | 46 |
|
47 | 47 | try:
|
48 | 48 | import gevent
|
49 |
| - from gevent import Greenlet, coros, monkey |
| 49 | + from gevent import Greenlet, monkey |
50 | 50 | has_gevent = True
|
51 | 51 | except ImportError:
|
52 | 52 | has_gevent = False
|
@@ -254,9 +254,7 @@ def run_mongo_thread(self):
|
254 | 254 | for i in range(self.start_request):
|
255 | 255 | self.connection.start_request()
|
256 | 256 |
|
257 |
| - # A reasonable number of docs here, depending on how many are inserted |
258 |
| - # in TestPooling.setUp() |
259 |
| - list(self.connection[DB].test.find()) |
| 257 | + list(self.connection[DB].test.find_one({'$where': delay(0.1)})) |
260 | 258 | for i in range(self.end_request):
|
261 | 259 | self.connection.end_request()
|
262 | 260 |
|
@@ -286,11 +284,7 @@ def setUp(self):
|
286 | 284 | db.test.drop()
|
287 | 285 | db.unique.insert({"_id": "jesse"})
|
288 | 286 |
|
289 |
| - # In tests like test_max_pool_size, we start some threads that will |
290 |
| - # perform simultaneous queries, forcing the pool to give out many |
291 |
| - # sockets. We need enough docs here that some threads are still in |
292 |
| - # progress when other threads start. |
293 |
| - db.test.insert([{} for i in range(3000)]) |
| 287 | + db.test.insert([{} for i in range(10)]) |
294 | 288 |
|
295 | 289 | def tearDown(self):
|
296 | 290 | self.c.close()
|
@@ -642,7 +636,7 @@ class _TestMaxPoolSize(_TestPoolingBase):
|
642 | 636 | """
|
643 | 637 | def _test_max_pool_size(self, start_request, end_request):
|
644 | 638 | c = self.get_connection(max_pool_size=4, auto_start_request=False)
|
645 |
| - nthreads = 40 |
| 639 | + nthreads = 10 |
646 | 640 |
|
647 | 641 | if (
|
648 | 642 | self.use_greenlets and sys.platform == 'darwin'
|
@@ -756,7 +750,7 @@ def find_slow():
|
756 | 750 | # Javascript function that pauses
|
757 | 751 | where = delay(2)
|
758 | 752 | results['find_slow_result'] = list(db.test.find(
|
759 |
| - {'$where': where} |
| 753 | + {'$where': where} |
760 | 754 | ))
|
761 | 755 |
|
762 | 756 | history.append('find_slow done')
|
|
0 commit comments