Fixed multiple /unzipmirror commands gets all the mirrors stuck

Signed-off-by: lzzy12 <jhashivam2020@gmail.com>
This commit is contained in:
lzzy12 2020-06-28 14:51:55 +05:30
parent fed3be2411
commit 1aed50a5f4
2 changed files with 6 additions and 2 deletions

View File

@ -62,7 +62,9 @@ def get_readable_file_size(size_in_bytes) -> str:
def getDownloadByGid(gid): def getDownloadByGid(gid):
with download_dict_lock: with download_dict_lock:
for dl in download_dict.values(): 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: if dl.gid() == gid:
return dl return dl
return None return None
@ -146,8 +148,10 @@ def new_thread(fn):
"""To use as decorator to make a function call threaded. """To use as decorator to make a function call threaded.
Needs import Needs import
from threading import Thread""" from threading import Thread"""
def wrapper(*args, **kwargs): def wrapper(*args, **kwargs):
thread = threading.Thread(target=fn, args=args, kwargs=kwargs) thread = threading.Thread(target=fn, args=args, kwargs=kwargs)
thread.start() thread.start()
return thread return thread
return wrapper return wrapper

View File

@ -8,7 +8,7 @@ class ExtractStatus(Status):
self.__path = path self.__path = path
self.__size = size 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 # If this is possible in future,we should implement it
def progress(self): def progress(self):