Skip to content

Commit

Permalink
chore: don't run cache in parallel
Browse files Browse the repository at this point in the history
  • Loading branch information
robcxyz committed May 17, 2024
1 parent e8130b8 commit 04958cd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion balanced_backend/api/health.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def is_database_online(session: bool = Depends(get_session)):

def is_cache_updated():
for k, v in cache.dict().items():
if len(v) == 0:
if not v:
logger.info(f"Unhealthy cache item {k}")
return True
return True
6 changes: 4 additions & 2 deletions balanced_backend/cache/cache_cron.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,12 @@ def cache_cron():
logger.info("Starting metrics server.")
sched = BlockingScheduler()

# Run the jobs immediately in parallel
asyncio.run(run_all_crons())
# # Run the jobs immediately in parallel
# asyncio.run(run_all_crons())

for i in CRONS:
# Run right away
run_cron_with_session(i['func'])
# Then run them in the scheduler
sched.add_job(
func=run_cron_with_session,
Expand Down

0 comments on commit 04958cd

Please sign in to comment.