Handle some more crashes related download cleanup
Signed-off-by: lzzy12 <jhashivam2020@gmail.com>
This commit is contained in:
parent
7b485d13b0
commit
17a08973e1
|
|
@ -66,7 +66,10 @@ class MirrorListener(listeners.MirrorListeners):
|
||||||
pass
|
pass
|
||||||
with download_dict_lock:
|
with download_dict_lock:
|
||||||
del download_dict[self.uid]
|
del download_dict[self.uid]
|
||||||
|
try:
|
||||||
fs_utils.clean_download(progress_status_list[index].path())
|
fs_utils.clean_download(progress_status_list[index].path())
|
||||||
|
except FileNotFoundError:
|
||||||
|
pass
|
||||||
msg = f"@{self.message.from_user.username} your download has been stopped due to: {error}"
|
msg = f"@{self.message.from_user.username} your download has been stopped due to: {error}"
|
||||||
sendMessage(msg, self.context, self.update)
|
sendMessage(msg, self.context, self.update)
|
||||||
|
|
||||||
|
|
@ -87,14 +90,20 @@ class MirrorListener(listeners.MirrorListeners):
|
||||||
except KeyError:
|
except KeyError:
|
||||||
pass
|
pass
|
||||||
sendMessage(msg, self.context, self.update)
|
sendMessage(msg, self.context, self.update)
|
||||||
|
try:
|
||||||
fs_utils.clean_download(progress_status_list[index].path())
|
fs_utils.clean_download(progress_status_list[index].path())
|
||||||
|
except FileNotFoundError:
|
||||||
|
pass
|
||||||
|
|
||||||
def onUploadError(self, error: str, progress_status: list, index: int):
|
def onUploadError(self, error: str, progress_status: list, index: int):
|
||||||
LOGGER.error(error)
|
LOGGER.error(error)
|
||||||
sendMessage(error, self.context, self.update)
|
sendMessage(error, self.context, self.update)
|
||||||
with download_dict_lock:
|
with download_dict_lock:
|
||||||
del download_dict[self.message.message_id]
|
del download_dict[self.message.message_id]
|
||||||
|
try:
|
||||||
fs_utils.clean_download(progress_status[index].path())
|
fs_utils.clean_download(progress_status[index].path())
|
||||||
|
except FileNotFoundError:
|
||||||
|
pass
|
||||||
|
|
||||||
def onUploadProgress(self, progress: list, index: int):
|
def onUploadProgress(self, progress: list, index: int):
|
||||||
msg = get_readable_message(progress)
|
msg = get_readable_message(progress)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue