Skip to content

Commit

Permalink
Some improvements (#441)
Browse files Browse the repository at this point in the history
* Improve the rebuild search index task

* Include dbbackups in make web command
  • Loading branch information
Xpirix authored Jul 15, 2024
1 parent 5a58da0 commit d095a5b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 14 deletions.
9 changes: 1 addition & 8 deletions dockerize/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 6 additions & 4 deletions qgis-app/plugins/tasks/rebuild_search_index.py
Original file line number Diff line number Diff line change
@@ -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'])
def rebuild_search_index():
"""
Celery task to rebuild the search index.
"""
update_index.Command().handle()
4 changes: 2 additions & 2 deletions qgis-app/settings_docker.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
}
}
Expand Down

0 comments on commit d095a5b

Please sign in to comment.