feat: introduce AP scheduler for polling vault

This commit is contained in:
ramvignesh-b
2026-04-17 23:37:48 +05:30
parent 3d764703dd
commit 1e7a1c15c9
6 changed files with 150 additions and 12 deletions
+14
View File
@@ -1,5 +1,19 @@
import os
from django.apps import AppConfig
class LettersConfig(AppConfig):
name = "letters"
def ready(self):
"""
Start the scheduler only when the server is starting.
NOTE: If we don't check for RUN_MAIN, the scheduler triggers for all django operations (migration, test etc.)
"""
if not (os.environ.get("RUN_MAIN") == "true" or os.environ.get("WERKZEUG_RUN_MAIN") == "true"):
return
from .tasks import start_scheduler
start_scheduler()