From 7eb74ae4f28289448558516d7837e8820a6947d8 Mon Sep 17 00:00:00 2001 From: Lova ANDRIARIMALALA <43842786+Xpirix@users.noreply.github.com> Date: Wed, 3 Jul 2024 14:20:29 +0300 Subject: [PATCH 1/2] Improve the rebuild search index task --- qgis-app/plugins/tasks/rebuild_search_index.py | 10 ++++++---- qgis-app/settings_docker.py | 4 ++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/qgis-app/plugins/tasks/rebuild_search_index.py b/qgis-app/plugins/tasks/rebuild_search_index.py index 198596d2..50c76d4d 100644 --- a/qgis-app/plugins/tasks/rebuild_search_index.py +++ b/qgis-app/plugins/tasks/rebuild_search_index.py @@ -1,10 +1,12 @@ from celery import shared_task +from haystack.management.commands import update_index from celery.utils.log import get_task_logger logger = get_task_logger(__name__) - @shared_task -def rebuild_index(): - import subprocess - subprocess.call(['python', 'manage.py', 'rebuild_index']) \ No newline at end of file +def rebuild_search_index(): + """ + Celery task to rebuild the search index. + """ + update_index.Command().handle() \ No newline at end of file diff --git a/qgis-app/settings_docker.py b/qgis-app/settings_docker.py index f3c6d085..5dd7c061 100644 --- a/qgis-app/settings_docker.py +++ b/qgis-app/settings_docker.py @@ -160,8 +160,8 @@ # Index synchronization sometimes fails when deleting # a plugin and None is listed in the search list. So I think # it would be better if we rebuild the index frequently - 'rebuild_index': { - 'task': 'plugins.tasks.rebuild_index.rebuild_index', + 'rebuild_search_index': { + 'task': 'plugins.tasks.rebuild_search_index.rebuild_search_index', 'schedule': crontab(minute=0, hour=3), # Execute every day at 3 AM. } } From d1f8cb74693bfc6451b073ac57b2b41c86ba735f Mon Sep 17 00:00:00 2001 From: Lova ANDRIARIMALALA <43842786+Xpirix@users.noreply.github.com> Date: Wed, 3 Jul 2024 14:32:42 +0300 Subject: [PATCH 2/2] Include dbbackups in make web command --- dockerize/Makefile | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/dockerize/Makefile b/dockerize/Makefile index 745c12ce..1522cfbc 100644 --- a/dockerize/Makefile +++ b/dockerize/Makefile @@ -35,14 +35,7 @@ web: db @echo "------------------------------------------------------------------" @echo "Running in production mode" @echo "------------------------------------------------------------------" - @docker compose -p $(PROJECT_ID) up -d --scale uwsgi=2 web worker beat - -dbbackups: db - @echo - @echo "------------------------------------------------------------------" - @echo "Running dbbackups in production mode" - @echo "------------------------------------------------------------------" - @docker compose -p $(PROJECT_ID) up -d dbbackups + @docker compose -p $(PROJECT_ID) up -d --scale uwsgi=2 web worker beat dbbackups certbot: web @echo