mirror of
https://github.com/autistic-symposium/web3-starter-py.git
synced 2025-05-17 22:20:22 -04:00
24 lines
556 B
Python
24 lines
556 B
Python
#!/usr/bin/env python3
|
|
|
|
import time
|
|
from gevent.pool import Pool
|
|
from gevent import monkey
|
|
|
|
# Note that you can spawn many workers with gevent since the cost of creating and switching is very low
|
|
NUM_WORKERS = 4
|
|
|
|
# Monkey-Patch socket module for HTTP requests
|
|
monkey.patch_socket()
|
|
|
|
start_time = time.time()
|
|
|
|
pool = Pool(NUM_WORKERS)
|
|
for address in WEBSITE_LIST:
|
|
pool.spawn(check_website, address)
|
|
|
|
# Wait for stuff to finish
|
|
pool.join()
|
|
|
|
end_time = time.time()
|
|
|
|
print("Time for GreenSquirrel: %ssecs" % (end_time - start_time))
|