Skip to content

Commit

Permalink
[#2509] Create celery task to rebuild search index
Browse files Browse the repository at this point in the history
  • Loading branch information
pi-sigma committed May 29, 2024
1 parent 9347350 commit 0ba5457
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/open_inwoner/search/tasks.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import logging

from django.core.management import call_command
from django.utils.translation import gettext as _

from open_inwoner.celery import app

logger = logging.getLogger(__name__)


@app.task(name=_("Rebuild search index"))
def rebuild_search_index():
logger.info("starting rebuild_search_index() task")

call_command("search_index", "--rebuild", "-f")

logger.info("finished rebuild_search_index() task")

0 comments on commit 0ba5457

Please sign in to comment.