|
|
@@ -7,6 +7,7 @@ from weather import all_city
|
|
|
import logging
|
|
|
import django
|
|
|
import time
|
|
|
+import random
|
|
|
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
|
|
sys.path.append(BASE_DIR)
|
|
|
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'bigdataAPI.settings')
|
|
|
@@ -88,7 +89,7 @@ def main():
|
|
|
day_obj.save()
|
|
|
except Exception as e:
|
|
|
logging.warning(f"cityid {day_obj.cityid} error {e} {today_response.text}")
|
|
|
- time.sleep(2)
|
|
|
+ time.sleep(random.randint(1, 5))
|
|
|
logging.warning("over today ...")
|
|
|
logging.warning("up server day ...")
|
|
|
server_days = ServerDayData.objects.all()
|
|
|
@@ -102,7 +103,7 @@ def main():
|
|
|
server_day_obj.save()
|
|
|
except Exception as e:
|
|
|
logging.warning(f"cityid {server_day_obj.cityid} error {e} {today_response.text}")
|
|
|
- time.sleep(2)
|
|
|
+ time.sleep(random.randint(1, 5))
|
|
|
logging.warning("over server day ...")
|
|
|
|
|
|
"""
|