Skip to content

Commit cff9512

Browse files
committed
update script
1 parent 3f7b7af commit cff9512

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

monitor/src/index.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import json
77
import threading
88
import requests
9+
import time
910
from requests.exceptions import HTTPError
1011

1112
website_url = json.loads(os.environ['Website_URL'])
@@ -67,18 +68,20 @@ def run_thread(site):
6768
print("[Error:] Site %s down" %site)
6869
write_metric(int(r), metricname, site)
6970

70-
def handler():
71+
def handler(event, context):
7172

7273
# Change these to your actual websites. Remember, the more websites you list
7374
# the longer the lambda function will run
7475
websiteurls = website_url
7576
t = [0]*len(website_url)
77+
j = 1
7678
for i in range(len(websiteurls)):
7779
t[i] = threading.Thread(target=run_thread, args=(website_url[i],))
80+
if j == 6:
81+
time.sleep(5)
7882
t[i].start()
83+
j = j+1
7984

8085
for i in range(len(t)):
8186
t[i].join()
82-
print("Done!")
83-
84-
handler()
87+
print("Done!")

0 commit comments

Comments
 (0)