cleanup notifications
This commit is contained in:
parent
db0ade203a
commit
2a0a04ac65
|
@ -242,6 +242,9 @@ class PendingList(PendingIndex):
|
|||
|
||||
total = len(self.missing_videos)
|
||||
for idx, (youtube_id, vid_type) in enumerate(self.missing_videos):
|
||||
if self.task and self.task.is_stopped():
|
||||
break
|
||||
|
||||
print(f"{youtube_id}: [{idx + 1}/{total}]: add to queue")
|
||||
self._notify_add(idx, total)
|
||||
video_details = self.get_youtube_details(youtube_id, vid_type)
|
||||
|
|
|
@ -206,5 +206,4 @@ class CommentList:
|
|||
"""send notification on task"""
|
||||
message = [f"Add comments for new videos {idx + 1}/{total_videos}"]
|
||||
progress = (idx + 1) / total_videos
|
||||
title = "Index Comments"
|
||||
self.task.send_progress(message, progress=progress, title=title)
|
||||
self.task.send_progress(message, progress=progress)
|
||||
|
|
|
@ -72,6 +72,9 @@ class TaskManager:
|
|||
run at startup to recover from hard reset
|
||||
"""
|
||||
all_results = self.get_all_results()
|
||||
if not all_results:
|
||||
return
|
||||
|
||||
for result in all_results:
|
||||
if result.get("status") == "PENDING":
|
||||
result["status"] = "FAILED"
|
||||
|
|
|
@ -63,6 +63,7 @@ class BaseTask(Task):
|
|||
"extract_download": {
|
||||
"title": "Add to download queue",
|
||||
"group": "download:add",
|
||||
"api-stop": True,
|
||||
},
|
||||
"check_reindex": {
|
||||
"title": "Reindex Documents",
|
||||
|
@ -195,6 +196,7 @@ def download_pending(self, from_queue=True):
|
|||
@shared_task(name="extract_download", bind=True, base=BaseTask)
|
||||
def extrac_dl(self, youtube_ids):
|
||||
"""parse list passed and add to pending"""
|
||||
TaskManager().init(self)
|
||||
pending_handler = PendingList(youtube_ids=youtube_ids, task=self)
|
||||
pending_handler.parse_url_list()
|
||||
pending_handler.add_to_pending()
|
||||
|
|
Loading…
Reference in New Issue