Refine
This commit is contained in:
@@ -77,8 +77,11 @@ def auto_cache_data():
|
|||||||
if not redis_client.exists(key):
|
if not redis_client.exists(key):
|
||||||
query_all_records_by_date_with_type_link(str_prev_day)
|
query_all_records_by_date_with_type_link(str_prev_day)
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
# auto cache data for the last 3 days
|
||||||
today = datetime.date.today()
|
today = datetime.date.today()
|
||||||
prev_day = today - datetime.timedelta(days=1)
|
for i in range(1, 4):
|
||||||
|
prev_day = today - datetime.timedelta(days=i)
|
||||||
str_prev_day = prev_day.strftime('%Y-%m-%d')
|
str_prev_day = prev_day.strftime('%Y-%m-%d')
|
||||||
print(str_prev_day)
|
print(str_prev_day)
|
||||||
|
|
||||||
@@ -90,6 +93,7 @@ def auto_cache_data():
|
|||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
auto_cache_data()
|
auto_cache_data()
|
||||||
|
|
||||||
|
# auto run in the midnight
|
||||||
schedule.every().day.at("03:00").do(auto_cache_data)
|
schedule.every().day.at("03:00").do(auto_cache_data)
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
|
|||||||
Reference in New Issue
Block a user