From 1aed50a5f40b6f5acf44fff02d4dca76e168f612 Mon Sep 17 00:00:00 2001 From: lzzy12 Date: Sun, 28 Jun 2020 14:51:55 +0530 Subject: [PATCH] Fixed multiple /unzipmirror commands gets all the mirrors stuck Signed-off-by: lzzy12 --- bot/helper/ext_utils/bot_utils.py | 6 +++++- bot/helper/mirror_utils/status_utils/extract_status.py | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/bot/helper/ext_utils/bot_utils.py b/bot/helper/ext_utils/bot_utils.py index 15a7feb..35452f2 100644 --- a/bot/helper/ext_utils/bot_utils.py +++ b/bot/helper/ext_utils/bot_utils.py @@ -62,7 +62,9 @@ def get_readable_file_size(size_in_bytes) -> str: def getDownloadByGid(gid): with download_dict_lock: for dl in download_dict.values(): - if dl.status() != MirrorStatus.STATUS_UPLOADING and dl.status() != MirrorStatus.STATUS_ARCHIVING: + status = dl.status() + if status != MirrorStatus.STATUS_UPLOADING and status != MirrorStatus.STATUS_ARCHIVING\ + and status != MirrorStatus.STATUS_EXTRACTING: if dl.gid() == gid: return dl return None @@ -146,8 +148,10 @@ def new_thread(fn): """To use as decorator to make a function call threaded. Needs import from threading import Thread""" + def wrapper(*args, **kwargs): thread = threading.Thread(target=fn, args=args, kwargs=kwargs) thread.start() return thread + return wrapper diff --git a/bot/helper/mirror_utils/status_utils/extract_status.py b/bot/helper/mirror_utils/status_utils/extract_status.py index f7f5e59..41b6ff5 100644 --- a/bot/helper/mirror_utils/status_utils/extract_status.py +++ b/bot/helper/mirror_utils/status_utils/extract_status.py @@ -8,7 +8,7 @@ class ExtractStatus(Status): self.__path = path self.__size = size - # The progress of Tar function cannot be tracked. So we just return dummy values. + # The progress of extract function cannot be tracked. So we just return dummy values. # If this is possible in future,we should implement it def progress(self):