mirror of
https://github.com/sissbruecker/linkding.git
synced 2025-08-07 02:48:27 +02:00
Replace django-background-tasks with huey (#657)
* Replace django-background-tasks with huey * Add command for migrating tasks * Add custom admin view * fix dockerfile * fix tests * fix tests in CI * fix task tests * implement retries * improve config * workaround to avoid running singlefile tasks in parallel * properly kill single-file sub-processes * use period task for HTML snapshots * clear task lock when starting task consumer * remove obsolete cleanup task command
This commit is contained in:
@@ -42,7 +42,7 @@ INSTALLED_APPS = [
|
||||
"widget_tweaks",
|
||||
"rest_framework",
|
||||
"rest_framework.authtoken",
|
||||
"background_task",
|
||||
"huey.contrib.djhuey",
|
||||
"mozilla_django_oidc",
|
||||
]
|
||||
|
||||
@@ -173,13 +173,27 @@ LD_DISABLE_BACKGROUND_TASKS = os.getenv("LD_DISABLE_BACKGROUND_TASKS", False) in
|
||||
"1",
|
||||
)
|
||||
|
||||
# django-background-tasks
|
||||
MAX_ATTEMPTS = 5
|
||||
# How many tasks will run in parallel
|
||||
# We want to keep this low to prevent SQLite lock errors and in general not to consume too much resources on smaller
|
||||
# specced systems like Raspberries. Should be OK as tasks are not time critical.
|
||||
BACKGROUND_TASK_RUN_ASYNC = True
|
||||
BACKGROUND_TASK_ASYNC_THREADS = 2
|
||||
# Huey task queue
|
||||
HUEY = {
|
||||
"huey_class": "huey.SqliteHuey",
|
||||
"filename": os.path.join(BASE_DIR, "data", "tasks.sqlite3"),
|
||||
"immediate": False,
|
||||
"results": False,
|
||||
"store_none": False,
|
||||
"utc": True,
|
||||
"consumer": {
|
||||
"workers": 2,
|
||||
"worker_type": "thread",
|
||||
"initial_delay": 5,
|
||||
"backoff": 1.15,
|
||||
"max_delay": 10,
|
||||
"scheduler_interval": 10,
|
||||
"periodic": True,
|
||||
"check_worker_health": True,
|
||||
"health_check_interval": 10,
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
# Enable OICD support if configured
|
||||
LD_ENABLE_OIDC = os.getenv("LD_ENABLE_OIDC", False) in (True, "True", "1")
|
||||
|
Reference in New Issue
Block a user