mirror of
https://git.vectorsigma.ru/public/tubearchivist.git
synced 2026-08-08 20:39:19 +00:00
improve comment notify timeouts
This commit is contained in:
@@ -210,6 +210,9 @@ class CommentList:
|
|||||||
return
|
return
|
||||||
|
|
||||||
total_videos = len(self.video_ids)
|
total_videos = len(self.video_ids)
|
||||||
|
if notify:
|
||||||
|
self._notify(f"add comments for {total_videos} videos", False)
|
||||||
|
|
||||||
for idx, video_id in enumerate(self.video_ids):
|
for idx, video_id in enumerate(self.video_ids):
|
||||||
comment = Comments(video_id, config=self.config)
|
comment = Comments(video_id, config=self.config)
|
||||||
if notify:
|
if notify:
|
||||||
@@ -219,16 +222,16 @@ class CommentList:
|
|||||||
comment.upload_comments()
|
comment.upload_comments()
|
||||||
|
|
||||||
if notify:
|
if notify:
|
||||||
self.notify_final(total_videos)
|
self._notify(f"added comments for {total_videos} videos", 5)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def notify_final(total_videos):
|
def _notify(message, expire):
|
||||||
"""send final notification"""
|
"""send notification"""
|
||||||
key = "message:download"
|
key = "message:download"
|
||||||
message = {
|
message = {
|
||||||
"status": key,
|
"status": key,
|
||||||
"level": "info",
|
"level": "info",
|
||||||
"title": "Download and index comments finished",
|
"title": "Download and index comments finished",
|
||||||
"message": f"added comments for {total_videos} videos",
|
"message": message,
|
||||||
}
|
}
|
||||||
RedisArchivist().set_message(key, message, expire=4)
|
RedisArchivist().set_message(key, message, expire=expire)
|
||||||
|
|||||||
Reference in New Issue
Block a user