Skip to content

Commit 603e65e

Browse files
committed
add batch
1 parent cd720e1 commit 603e65e

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

proxypool/setting.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,6 @@
3535
TESTER_ENABLED = True
3636
GETTER_ENABLED = True
3737
API_ENABLED = True
38+
39+
# 最大批测试量
40+
BATCH_TEST_SIZE = 100

proxypool/tester.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,8 @@ def run(self):
4747
try:
4848
proxies = self.redis.all()
4949
loop = asyncio.get_event_loop()
50-
batch_size = 100
51-
for i in range(0, len(proxies), batch_size):
52-
test_proxies = proxies[i:i + batch_size]
50+
for i in range(0, len(proxies), BATCH_TEST_SIZE):
51+
test_proxies = proxies[i:i + BATCH_TEST_SIZE]
5352
tasks = [self.test_single_proxy(proxy) for proxy in test_proxies]
5453
loop.run_until_complete(asyncio.wait(tasks))
5554
time.sleep(5)

0 commit comments

Comments
 (0)