From 61f95886525a888fbc9edd1b31437563a94c291b Mon Sep 17 00:00:00 2001 From: MuslemRahimi Date: Wed, 28 Aug 2024 20:44:08 +0200 Subject: [PATCH] update timer --- app/primary_cron_job.py | 5 +++-- app/secondary_cron_job.py | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/app/primary_cron_job.py b/app/primary_cron_job.py index 6eff133..5540c69 100755 --- a/app/primary_cron_job.py +++ b/app/primary_cron_job.py @@ -57,10 +57,11 @@ def run_command(command): if stderr: logger.error("Error:\n" + stderr) -def run_json_job(): +def run_json(): # Run the asynchronous function inside an asyncio loop run_command(["python3", "restart_json.py"]) run_command(["pm2", "restart","fastapi"]) + run_command(["pm2", "restart","fastify"]) def run_pocketbase(): # Run the asynchronous function inside an asyncio loop @@ -596,7 +597,7 @@ schedule.every(15).minutes.do(run_threaded, run_market_moods).tag('market_moods_ #schedule.every(10).minutes.do(run_threaded, run_dark_pool_flow).tag('dark_pool_flow_job') schedule.every(2).hours.do(run_threaded, run_fda_calendar).tag('fda_calendar_job') -schedule.every(3).hours.do(run_threaded, run_json_job).tag('json_job') +schedule.every(2).hours.do(run_threaded, run_json).tag('json_job') #schedule.every(4).hours.do(run_threaded, run_share_statistics).tag('share_statistics_job') schedule.every(6).hours.do(run_threaded, run_analyst_rating).tag('analyst_job') diff --git a/app/secondary_cron_job.py b/app/secondary_cron_job.py index 9bc8c2f..18c76f6 100755 --- a/app/secondary_cron_job.py +++ b/app/secondary_cron_job.py @@ -33,6 +33,7 @@ def run_json_job(): # Run the asynchronous function inside an asyncio loop subprocess.run(["python3", "restart_json.py"]) subprocess.run(["pm2", "restart","fastapi"]) + subprocess.run(["pm2", "restart","fastify"]) # Create functions to run each schedule in a separate thread @@ -42,7 +43,7 @@ def run_threaded(job_func): schedule.every().day.at("15:45").do(run_threaded, run_restart_cache) -schedule.every(3).hours.do(run_threaded, run_json_job).tag('json_job') +schedule.every(2).hours.do(run_threaded, run_json_job).tag('json_job') while True: schedule.run_pending()