File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change 66import json
77import threading
88import requests
9+ import time
910from requests .exceptions import HTTPError
1011
1112website_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!" )
You can’t perform that action at this time.
0 commit comments