only load django huey config when not getting help or version to avoid creating queue.sqlite3

This commit is contained in:
Nick Sweeting 2024-10-21 00:38:17 -07:00
parent 02a1fc3049
commit d48a99ab64
No known key found for this signature in database

View file

@ -263,37 +263,38 @@ MIGRATION_MODULES = {'signal_webhooks': None}
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField' DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
HUEY = { if not IS_GETTING_VERSION_OR_HELP: # dont create queue.sqlite3 file if we're just running to get --version or --help
"huey_class": "huey.SqliteHuey", HUEY = {
"filename": CONSTANTS.QUEUE_DATABASE_FILENAME, "huey_class": "huey.SqliteHuey",
"name": "system_tasks", "filename": CONSTANTS.QUEUE_DATABASE_FILENAME,
"results": True, "name": "system_tasks",
"store_none": True, "results": True,
"immediate": False, "store_none": True,
"utc": True, "immediate": False,
"consumer": { "utc": True,
"workers": 1, "consumer": {
"worker_type": "thread", "workers": 1,
"initial_delay": 0.1, # Smallest polling interval, same as -d. "worker_type": "thread",
"backoff": 1.15, # Exponential backoff using this rate, -b. "initial_delay": 0.1, # Smallest polling interval, same as -d.
"max_delay": 10.0, # Max possible polling interval, -m. "backoff": 1.15, # Exponential backoff using this rate, -b.
"scheduler_interval": 1, # Check schedule every second, -s. "max_delay": 10.0, # Max possible polling interval, -m.
"periodic": True, # Enable crontab feature. "scheduler_interval": 1, # Check schedule every second, -s.
"check_worker_health": True, # Enable worker health checks. "periodic": True, # Enable crontab feature.
"health_check_interval": 1, # Check worker health every second. "check_worker_health": True, # Enable worker health checks.
}, "health_check_interval": 1, # Check worker health every second.
} },
}
# https://huey.readthedocs.io/en/latest/contrib.html#setting-things-up # https://huey.readthedocs.io/en/latest/contrib.html#setting-things-up
# https://github.com/gaiacoop/django-huey # https://github.com/gaiacoop/django-huey
DJANGO_HUEY = { DJANGO_HUEY = {
"default": "system_tasks", "default": "system_tasks",
"queues": { "queues": {
HUEY["name"]: HUEY.copy(), HUEY["name"]: HUEY.copy(),
# more registered here at plugin import-time by BaseQueue.register() # more registered here at plugin import-time by BaseQueue.register()
**abx.django.use.get_DJANGO_HUEY_QUEUES(QUEUE_DATABASE_NAME=CONSTANTS.QUEUE_DATABASE_FILENAME), **abx.django.use.get_DJANGO_HUEY_QUEUES(QUEUE_DATABASE_NAME=CONSTANTS.QUEUE_DATABASE_FILENAME),
}, },
} }
class HueyDBRouter: class HueyDBRouter:
""" """