-
Notifications
You must be signed in to change notification settings - Fork 0
Patch20250310: fixup size check didn't read local file #206
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
578706b
move upload status check into dedicated function for upload/resume logic
colorzzr 3ae6640
add test case for checking status timeout
colorzzr 2c27a9f
fixup the size check when resumable uploading
colorzzr 5f5e205
bumpup version
colorzzr a932649
bumpup version
colorzzr 00d2a9e
bumpup version
colorzzr File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,6 +8,7 @@ | |
| import math | ||
| import os | ||
| import threading | ||
| import time | ||
| from logging import getLogger | ||
| from multiprocessing.pool import ThreadPool | ||
| from typing import Any | ||
|
|
@@ -30,6 +31,7 @@ | |
| from app.services.output_manager.error_handler import SrvErrorHandler | ||
| from app.services.user_authentication.decorator import require_valid_token | ||
| from app.utils.aggregated import ItemStatus | ||
| from app.utils.aggregated import batch_generator | ||
| from app.utils.aggregated import get_file_info_by_geid | ||
|
|
||
| from .exception import INVALID_CHUNK_ETAG | ||
|
|
@@ -471,5 +473,32 @@ def check_status(self, file_objects: list[FileObject]) -> list[FileObject]: | |
|
|
||
| return unfinished_files | ||
|
|
||
| def upload_status_check(self, file_objects: list[FileObject]) -> None: | ||
| ''' | ||
| Summary: | ||
| The function is to check the list of upload status. | ||
|
|
||
| Parameter: | ||
| - file_objects(list[FileObject]): the list of file objects that need to be checked. | ||
|
|
||
| ''' | ||
|
|
||
| unfinished_files = file_objects | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove this line |
||
| wait_count = 0 | ||
| while len(unfinished_files) > 0: | ||
| temp = [] | ||
| if wait_count % AppConfig.Env.output_truncate_count == 0: | ||
| mhandler.SrvOutPutHandler.finalize_upload() | ||
| elif wait_count > AppConfig.Env.max_waiting_count: | ||
| SrvErrorHandler.customized_handle(ECustomizedError.UPLOAD_TIMEOUT, True) | ||
|
|
||
| for file_batchs in batch_generator(file_objects, batch_size=AppConfig.Env.upload_batch_size): | ||
| temp.extend(self.check_status(file_batchs)) | ||
| unfinished_files = temp | ||
| wait_count += 1 | ||
| time.sleep(1) | ||
|
|
||
| return | ||
|
|
||
| def set_finish_upload(self): | ||
| self.finish_upload = True | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can directly naming it as this and remove the first line of the function