clear queue on stop

This commit is contained in:
simon 2023-03-31 10:09:54 +07:00
parent 2a0a04ac65
commit 981a4cb8b3
No known key found for this signature in database
GPG Key ID: 2C15AA5E89985DD4
1 changed files with 1 additions and 3 deletions

View File

@ -150,8 +150,6 @@ class VideoDownloader:
if not initiated with list, take from queue
"""
MSG = "message:download"
def __init__(self, youtube_id_list=False, task=False):
self.obs = False
self.video_overwrites = False
@ -165,7 +163,6 @@ class VideoDownloader:
def run_queue(self):
"""setup download queue in redis loop until no more items"""
self._setup_queue()
queue = RedisQueue(queue_name="dl_queue")
limit_queue = self.config["downloads"]["limit_count"]
@ -175,6 +172,7 @@ class VideoDownloader:
while True:
youtube_data = queue.get_next()
if self.task.is_stopped() or not youtube_data:
queue.clear()
break
youtube_data = json.loads(youtube_data)