download now task handling

This commit is contained in:
simon 2023-04-29 13:22:10 +07:00
parent 8f3b832069
commit efca460e9d
No known key found for this signature in database
GPG Key ID: 2C15AA5E89985DD4
2 changed files with 10 additions and 2 deletions

View File

@ -15,7 +15,13 @@ from home.src.ta.config import AppConfig
from home.src.ta.ta_redis import RedisArchivist
from home.src.ta.task_manager import TaskCommand, TaskManager
from home.src.ta.urlparser import Parser
from home.tasks import BaseTask, check_reindex, extrac_dl, subscribe_to
from home.tasks import (
BaseTask,
check_reindex,
download_pending,
extrac_dl,
subscribe_to,
)
from rest_framework.authentication import (
SessionAuthentication,
TokenAuthentication,
@ -431,6 +437,8 @@ class DownloadApiView(ApiBaseView):
print(f"{video_id}: change status to {item_status}")
PendingInteract(video_id, item_status).update_status()
if item_status == "priority":
download_pending.delay(auto_only=True)
return Response(request.data)

View File

@ -118,7 +118,7 @@ class PendingInteract:
else:
data = {"doc": {"status": self.status}}
path = f"ta_download/_update/{self.youtube_id}"
path = f"ta_download/_update/{self.youtube_id}/?refresh=true"
_, _ = ElasticWrap(path).post(data=data)
def get_item(self):