This commit is contained in:
DingZQ
2025-03-22 12:42:08 +08:00
parent 98739b2510
commit 8c930f1f7d

View File

@@ -77,8 +77,11 @@ def auto_cache_data():
if not redis_client.exists(key):
query_all_records_by_date_with_type_link(str_prev_day)
"""
# auto cache data for the last 3 days
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')
print(str_prev_day)
@@ -90,6 +93,7 @@ def auto_cache_data():
if __name__ == "__main__":
auto_cache_data()
# auto run in the midnight
schedule.every().day.at("03:00").do(auto_cache_data)
while True: