From 94b4efb69f8796faba758ea2ed38c02072b65dfa Mon Sep 17 00:00:00 2001 From: MuslemRahimi Date: Tue, 3 Dec 2024 22:44:00 +0100 Subject: [PATCH] update cron job --- app/create_stock_db.py | 2 +- app/secondary_cron_job.py | 6 ++++-- fastify/app.js | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/app/create_stock_db.py b/app/create_stock_db.py index 4c1a655..fe6eab3 100755 --- a/app/create_stock_db.py +++ b/app/create_stock_db.py @@ -351,7 +351,7 @@ async def fetch_tickers(): db = StockDatabase('backup_db/stocks.db') loop = asyncio.get_event_loop() all_tickers = loop.run_until_complete(fetch_tickers()) -#all_tickers = [item for item in all_tickers if item['symbol'] == 'KRKNF'] +#all_tickers = [item for item in all_tickers if item['symbol'] == 'ZJK'] ''' existing_names = set() diff --git a/app/secondary_cron_job.py b/app/secondary_cron_job.py index 26a4bac..d720d78 100755 --- a/app/secondary_cron_job.py +++ b/app/secondary_cron_job.py @@ -32,6 +32,7 @@ def run_restart_cache(): if week <= 5: subprocess.run(["pm2", "restart","fastapi"]) subprocess.run(["pm2", "restart","fastify"]) + subprocess.run(["pm2", "restart","websocket"]) def run_json_job(): @@ -51,8 +52,9 @@ def run_threaded(job_func): job_thread.start() -#schedule.every().day.at("06:30").do(run_threaded, run_pocketbase).tag('pocketbase_job') -schedule.every().day.at("15:45").do(run_threaded, run_restart_cache) +schedule.every().day.at("06:30").do(run_threaded, run_pocketbase).tag('pocketbase_job') +schedule.every().day.at("15:31").do(run_threaded, run_restart_cache) +schedule.every().day.at("23:00").do(run_threaded, run_restart_cache) schedule.every(2).hours.do(run_threaded, run_json_job).tag('json_job') schedule.every(1).minutes.do(run_threaded, run_cron_price_alert).tag('price_alert_job') diff --git a/fastify/app.js b/fastify/app.js index ea97d53..0f610c9 100755 --- a/fastify/app.js +++ b/fastify/app.js @@ -256,7 +256,7 @@ fastify.register(async function (fastify) { for (const symbol of tickers) { const filePath = path?.join( __dirname, - `../app/json/websocket/companies/${symbol}.json` + `../app/json/websocket/companies/${symbol?.toUpperCase()}.json` ); try { if (fs?.existsSync(filePath)) {