From d48a99ab64d5afaceb618cd12fe5d9da0ddaf5fb Mon Sep 17 00:00:00 2001 From: Nick Sweeting Date: Mon, 21 Oct 2024 00:38:17 -0700 Subject: [PATCH] only load django huey config when not getting help or version to avoid creating queue.sqlite3 --- archivebox/core/settings.py | 61 +++++++++++++++++++------------------ 1 file changed, 31 insertions(+), 30 deletions(-) diff --git a/archivebox/core/settings.py b/archivebox/core/settings.py index b84fadb9..3810954e 100644 --- a/archivebox/core/settings.py +++ b/archivebox/core/settings.py @@ -263,37 +263,38 @@ MIGRATION_MODULES = {'signal_webhooks': None} DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField' -HUEY = { - "huey_class": "huey.SqliteHuey", - "filename": CONSTANTS.QUEUE_DATABASE_FILENAME, - "name": "system_tasks", - "results": True, - "store_none": True, - "immediate": False, - "utc": True, - "consumer": { - "workers": 1, - "worker_type": "thread", - "initial_delay": 0.1, # Smallest polling interval, same as -d. - "backoff": 1.15, # Exponential backoff using this rate, -b. - "max_delay": 10.0, # Max possible polling interval, -m. - "scheduler_interval": 1, # Check schedule every second, -s. - "periodic": True, # Enable crontab feature. - "check_worker_health": True, # Enable worker health checks. - "health_check_interval": 1, # Check worker health every second. - }, -} +if not IS_GETTING_VERSION_OR_HELP: # dont create queue.sqlite3 file if we're just running to get --version or --help + HUEY = { + "huey_class": "huey.SqliteHuey", + "filename": CONSTANTS.QUEUE_DATABASE_FILENAME, + "name": "system_tasks", + "results": True, + "store_none": True, + "immediate": False, + "utc": True, + "consumer": { + "workers": 1, + "worker_type": "thread", + "initial_delay": 0.1, # Smallest polling interval, same as -d. + "backoff": 1.15, # Exponential backoff using this rate, -b. + "max_delay": 10.0, # Max possible polling interval, -m. + "scheduler_interval": 1, # Check schedule every second, -s. + "periodic": True, # Enable crontab feature. + "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://github.com/gaiacoop/django-huey -DJANGO_HUEY = { - "default": "system_tasks", - "queues": { - HUEY["name"]: HUEY.copy(), - # more registered here at plugin import-time by BaseQueue.register() - **abx.django.use.get_DJANGO_HUEY_QUEUES(QUEUE_DATABASE_NAME=CONSTANTS.QUEUE_DATABASE_FILENAME), - }, -} + # https://huey.readthedocs.io/en/latest/contrib.html#setting-things-up + # https://github.com/gaiacoop/django-huey + DJANGO_HUEY = { + "default": "system_tasks", + "queues": { + HUEY["name"]: HUEY.copy(), + # more registered here at plugin import-time by BaseQueue.register() + **abx.django.use.get_DJANGO_HUEY_QUEUES(QUEUE_DATABASE_NAME=CONSTANTS.QUEUE_DATABASE_FILENAME), + }, + } class HueyDBRouter: """