Skip to content

Commit

Permalink
increase attempt
Browse files Browse the repository at this point in the history
  • Loading branch information
weebzone authored Dec 9, 2022
1 parent 65a03f2 commit ea66b0f
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions bot/helper/mirror_utils/upload_utils/gdriveTools.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ def __getIdFromUrl(link: str):
parsed = urlparse(link)
return parse_qs(parsed.query)['id'][0]

@retry(wait=wait_exponential(multiplier=2, min=3, max=6), stop=stop_after_attempt(3),
@retry(wait=wait_exponential(multiplier=2, min=3, max=6), stop=stop_after_attempt(10),
retry=retry_if_exception_type(Exception))
def __set_permission(self, file_id):
permissions = {
Expand All @@ -149,13 +149,13 @@ def __set_permission(self, file_id):
}
return self.__service.permissions().create(fileId=file_id, body=permissions, supportsAllDrives=True).execute()

@retry(wait=wait_exponential(multiplier=2, min=3, max=6), stop=stop_after_attempt(3),
@retry(wait=wait_exponential(multiplier=2, min=3, max=6), stop=stop_after_attempt(10),
retry=retry_if_exception_type(Exception))
def __getFileMetadata(self, file_id):
return self.__service.files().get(fileId=file_id, supportsAllDrives=True,
fields='name, id, mimeType, size').execute()

@retry(wait=wait_exponential(multiplier=2, min=3, max=6), stop=stop_after_attempt(3),
@retry(wait=wait_exponential(multiplier=2, min=3, max=6), stop=stop_after_attempt(10),
retry=retry_if_exception_type(Exception))
def __getFilesByFolderId(self, folder_id):
page_token = None
Expand Down Expand Up @@ -272,7 +272,7 @@ def __upload_dir(self, input_directory, dest_id, user_id):
break
return new_id

@retry(wait=wait_exponential(multiplier=2, min=3, max=6), stop=stop_after_attempt(3),
@retry(wait=wait_exponential(multiplier=2, min=3, max=6), stop=stop_after_attempt(10),
retry=retry_if_exception_type(Exception))
def __create_directory(self, directory_name, dest_id, user_id):
# Change file name
Expand All @@ -292,7 +292,7 @@ def __create_directory(self, directory_name, dest_id, user_id):
LOGGER.info("Created G-Drive Folder:\nName: {}\nID: {} ".format(file.get("name"), file_id))
return file_id

@retry(wait=wait_exponential(multiplier=2, min=3, max=6), stop=stop_after_attempt(3),
@retry(wait=wait_exponential(multiplier=2, min=3, max=6), stop=stop_after_attempt(10),
retry=(retry_if_exception_type(Exception)))
def __upload_file(self, file_path, file_name, mime_type, dest_id, user_id):
# Change file name
Expand Down Expand Up @@ -475,7 +475,7 @@ def __cloneFolder(self, name, local_path, folder_id, dest_id, user_id):
if self.__is_cancelled:
break

@retry(wait=wait_exponential(multiplier=2, min=3, max=6), stop=stop_after_attempt(3),
@retry(wait=wait_exponential(multiplier=2, min=3, max=6), stop=stop_after_attempt(10),
retry=retry_if_exception_type(Exception))
def __copyFile(self, file_id, dest_id, file_name, user_id):
# Change file name
Expand Down Expand Up @@ -913,7 +913,7 @@ def __download_folder(self, folder_id, path, folder_name):
if self.__is_cancelled:
break

@retry(wait=wait_exponential(multiplier=2, min=3, max=6), stop=stop_after_attempt(3),
@retry(wait=wait_exponential(multiplier=2, min=3, max=6), stop=stop_after_attempt(10),
retry=(retry_if_exception_type(Exception)))
def __download_file(self, file_id, path, filename, mime_type):
request = self.__service.files().get_media(fileId=file_id, supportsAllDrives=True)
Expand Down

0 comments on commit ea66b0f

Please sign in to comment.