Skip to content

Commit

Permalink
Set scheduler interval configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
ipdae committed Sep 26, 2024
1 parent 60b0c73 commit cb53fcb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions world_boss/app/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ class Settings(BaseSettings):
headless_jwt_iss: str
headless_jwt_algorithm: str
planet_id: str
scheduler_interval: int = 60 * 5

class Config:
env_file = ".env"
Expand Down Expand Up @@ -70,6 +71,7 @@ class Config:
"headless_jwt_iss": {"env": "HEADLESS_JWT_ISS"},
"headless_jwt_algorithm": {"env": "HEADLESS_JWT_ALGORITHM"},
"planet_id": {"env": "PLANET_ID"},
"scheduler_interval": {"env": "SCHEDULER_INTERVAL"},
}


Expand Down
3 changes: 2 additions & 1 deletion world_boss/app/scheduler.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from apscheduler.schedulers.background import BackgroundScheduler

from world_boss.app.config import config
from world_boss.app.tasks import check_season

scheduler = BackgroundScheduler()
Expand All @@ -9,4 +10,4 @@ def check():
check_season.delay()


scheduler.add_job(check, "interval", seconds=60 * 30)
scheduler.add_job(check, "interval", seconds=config.scheduler_interval)

0 comments on commit cb53fcb

Please sign in to comment.