update cron job

This commit is contained in:
MuslemRahimi 2024-12-03 22:44:00 +01:00
parent d5cf64199d
commit 94b4efb69f
3 changed files with 6 additions and 4 deletions

View File

@ -351,7 +351,7 @@ async def fetch_tickers():
db = StockDatabase('backup_db/stocks.db') db = StockDatabase('backup_db/stocks.db')
loop = asyncio.get_event_loop() loop = asyncio.get_event_loop()
all_tickers = loop.run_until_complete(fetch_tickers()) 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() existing_names = set()

View File

@ -32,6 +32,7 @@ def run_restart_cache():
if week <= 5: if week <= 5:
subprocess.run(["pm2", "restart","fastapi"]) subprocess.run(["pm2", "restart","fastapi"])
subprocess.run(["pm2", "restart","fastify"]) subprocess.run(["pm2", "restart","fastify"])
subprocess.run(["pm2", "restart","websocket"])
def run_json_job(): def run_json_job():
@ -51,8 +52,9 @@ def run_threaded(job_func):
job_thread.start() job_thread.start()
#schedule.every().day.at("06:30").do(run_threaded, run_pocketbase).tag('pocketbase_job') 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("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(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') schedule.every(1).minutes.do(run_threaded, run_cron_price_alert).tag('price_alert_job')

View File

@ -256,7 +256,7 @@ fastify.register(async function (fastify) {
for (const symbol of tickers) { for (const symbol of tickers) {
const filePath = path?.join( const filePath = path?.join(
__dirname, __dirname,
`../app/json/websocket/companies/${symbol}.json` `../app/json/websocket/companies/${symbol?.toUpperCase()}.json`
); );
try { try {
if (fs?.existsSync(filePath)) { if (fs?.existsSync(filePath)) {