Skip to content

Commit

Permalink
Fixed multiple /unzipmirror commands gets all the mirrors stuck
Browse files Browse the repository at this point in the history
Signed-off-by: lzzy12 <[email protected]>
  • Loading branch information
lzzy12 committed Jun 28, 2020
1 parent fed3be2 commit 1aed50a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion bot/helper/ext_utils/bot_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
2 changes: 1 addition & 1 deletion bot/helper/mirror_utils/status_utils/extract_status.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ def __init__(self, name, path, size):
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):
Expand Down

0 comments on commit 1aed50a

Please sign in to comment.