Skip to content

Commit

Permalink
chore
Browse files Browse the repository at this point in the history
  • Loading branch information
Guovin committed Feb 6, 2024
1 parent 32f1625 commit 74d9053
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 74d9053

Please sign in to comment.