update cron job industry

This commit is contained in:
MuslemRahimi 2024-09-17 15:47:48 +02:00
parent 32b4a49944
commit 006fe42073
2 changed files with 14 additions and 1 deletions

View File

@ -3685,7 +3685,7 @@ async def get_sector_overview(data: TickerData, api_key: str = Security(get_api_
compressed_data = gzip.compress(data)
redis_client.set(cache_key, compressed_data)
redis_client.expire(cache_key,3600*3600)
redis_client.expire(cache_key,60*15)
return StreamingResponse(
io.BytesIO(compressed_data),

View File

@ -126,6 +126,17 @@ def run_cron_sector():
]
run_command(command)
def run_cron_industry():
week = datetime.today().weekday()
if week <= 5:
run_command(["python3", "cron_industry.py"])
command = [
"sudo", "rsync", "-avz", "-e", "ssh",
"/root/backend/app/json/industry",
f"root@{useast_ip_address}:/root/backend/app/json"
]
run_command(command)
def run_analyst_estimate():
week = datetime.today().weekday()
if week <= 5:
@ -617,6 +628,8 @@ schedule.every(5).minutes.do(run_threaded, run_cron_market_movers).tag('market_m
schedule.every(30).minutes.do(run_threaded, run_dividend_list).tag('dividend_list_job')
schedule.every(15).minutes.do(run_threaded, run_cron_market_news).tag('market_news_job')
schedule.every(15).minutes.do(run_threaded, run_cron_industry).tag('industry_job')
schedule.every(10).minutes.do(run_threaded, run_one_day_price).tag('one_day_price_job')
schedule.every(15).minutes.do(run_threaded, run_cron_heatmap).tag('heatmap_job')