Commit 13bbac12 authored by Michal Čihař's avatar Michal Čihař

Improve index cleanup

Using STORAGE.clean does seem to fail in some cases when there are
temporary directories.
Signed-off-by: default avatarMichal Čihař <michal@cihar.com>
parent 819cd7c2
......@@ -33,6 +33,7 @@ from whoosh.writing import AsyncWriter, BufferedWriter
from django.dispatch import receiver
from weblate.lang.models import Language
from weblate.trans.data import data_dir
import shutil
STORAGE = FileStorage(data_dir('whoosh'))
......@@ -60,7 +61,8 @@ def clean_indexes():
"""
Cleans all indexes.
"""
STORAGE.clean()
shutil.rmtree(data_dir('whoosh'))
STORAGE.create()
@receiver(post_migrate)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment