From 74d90535a9703992a040b0ecfab431749b7fd589 Mon Sep 17 00:00:00 2001 From: "guorong.zheng" <360996299@qq.com> Date: Tue, 6 Feb 2024 23:34:15 +0800 Subject: [PATCH] chore --- main.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main.py b/main.py index 267b383f7f9..e918c67984b 100644 --- a/main.py +++ b/main.py @@ -69,11 +69,11 @@ def getSpeed(self,url): except: print('request timeout or error') end = time.time() - return url, end - start # 返回 URL 和响应时间 + return url, end - start def compareSpeed(self,pageUrls): response_times = [] - with ThreadPoolExecutor(max_workers=20) as executor: # 创建一个线程池,最大并发数为 20 + with ThreadPoolExecutor(max_workers=20) as executor: future_to_url = {executor.submit(self.getSpeed, url): url for url in pageUrls} for future in concurrent.futures.as_completed(future_to_url): url, response_time = future.result()