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):
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

View File

@ -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):