diff --git a/pyproject.toml b/pyproject.toml index 69f391bc0..06a5ec2ea 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -83,6 +83,7 @@ async-timeout = "^5.0.1" aiohttp = "^3.11.11" scout-apm = "^3.2.1" newrelic = "^10.4.0" +apscheduler="^3.11.0" [tool.poetry.group.dev.dependencies] black = "^24.8.0" diff --git a/website/apps.py b/website/apps.py index 864790176..9a443deec 100644 --- a/website/apps.py +++ b/website/apps.py @@ -7,3 +7,7 @@ class WebsiteConfig(AppConfig): def ready(self): import website.signals # noqa + + from . import scheduler_config + + scheduler_config.start() diff --git a/website/scheduler_config.py b/website/scheduler_config.py new file mode 100644 index 000000000..da747c873 --- /dev/null +++ b/website/scheduler_config.py @@ -0,0 +1,12 @@ +from apscheduler.schedulers.background import BackgroundScheduler +from django.core.management import call_command + + +def MonitorJob(): + call_command("check_keywords") + + +def start(): + scheduler = BackgroundScheduler() + scheduler.add_job(MonitorJob, "interval", weeks=1) + scheduler.start()