refactor check_reindex task for ReindexManual

This commit is contained in:
simon 2022-12-11 15:56:44 +07:00
parent 617790b68f
commit 0f6bc3a420
No known key found for this signature in database
GPG Key ID: 2C15AA5E89985DD4
2 changed files with 8 additions and 9 deletions

View File

@ -351,12 +351,6 @@ class Reindex(ReindexBase):
return valid
def reindex_outdated():
"""reindex all outdated"""
ReindexOutdated().add_outdated()
Reindex().reindex_all()
class ChannelUrlFixer:
"""fix not matching channel names in reindex"""

View File

@ -21,7 +21,7 @@ from home.src.es.backup import ElasticBackup
from home.src.es.index_setup import ElasitIndexWrap
from home.src.index.channel import YoutubeChannel
from home.src.index.filesystem import ImportFolderScanner, scan_filesystem
from home.src.index.reindex import reindex_outdated
from home.src.index.reindex import Reindex, ReindexManual, ReindexOutdated
from home.src.ta.config import AppConfig, ScheduleBuilder
from home.src.ta.helper import UrlListParser, clear_dl_cache
from home.src.ta.ta_redis import RedisArchivist, RedisQueue
@ -133,9 +133,14 @@ def extrac_dl(youtube_ids):
@shared_task(name="check_reindex")
def check_reindex():
def check_reindex(data=False, extract_videos=False):
"""run the reindex main command"""
reindex_outdated()
if data:
ReindexManual(extract_videos=extract_videos).extract_data(data)
else:
ReindexOutdated().add_outdated()
Reindex().reindex_all()
@shared_task