Skip to content
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

fix: absolute paths not working in sandbox #3794

Merged
merged 3 commits into from
Oct 4, 2021
Merged

fix: absolute paths not working in sandbox #3794

merged 3 commits into from
Oct 4, 2021

Conversation

harsh62
Copy link
Member

@harsh62 harsh62 commented Sep 28, 2021

Issue #1697
Description of changes:
The purpose of the PR is to fix the following 2 issues:

  • Saving relative path of files in the DB to avoid issues arising with sandbox path changing after app restarts.
  • Address one small issue where the automatic upload didn't complete to more that 50% during multipart upload because of the max concurrency number set.

Check points:

  • All unit tests pass
  • All integration tests pass
  • Updated CHANGELOG.md
  • Documentation update for the change if required
  • PR title conforms to conventional commit style

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

…ming upload tasks that were pending upon app kill/restart
@harsh62 harsh62 requested a review from brennanMKE September 28, 2021 17:11
@harsh62 harsh62 marked this pull request as ready for review September 28, 2021 17:57
@@ -325,8 +332,10 @@ + (void)registerS3TransferUtilityWithConfiguration:(AWSServiceConfiguration *)co
recoverState:NO
completionHandler:completionHandler];
if (s3TransferUtility) {
NSAssert(_serviceClients != nil, @"Value is required");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should be using NSCAssert instead of NSAssert since it does not work with ARC.

@@ -38,7 +38,7 @@
static NSString *const AWSS3TransferUtilityRetrySucceeded = @"AWSS3TransferUtilityRetrySucceeded";
static NSUInteger const AWSS3TransferUtilityMultiPartSize = 5 * 1024 * 1024;
static NSString *const AWSS3TransferUtiltityRequestTimeoutErrorCode = @"RequestTimeout";
static int const AWSS3TransferUtilityMultiPartDefaultConcurrencyLimit = 5;
static int const AWSS3TransferUtilityMultiPartDefaultConcurrencyLimit = 10;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This value should not be changed as a part of this bug fix.

@@ -1395,6 +1396,9 @@ - (void) retryUpload: (AWSS3TransferUtilityUploadTask *) transferUtilityUploadTa
}
}

//Save in Database after the file has been created, so that file can be referenced incase upload is paused and needs to be restarted.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would put do this if there is no error by adjusting the if statement below. I think that makes sense.

if (!subTaskCreationError) {
    //Save in Database after the file has been created, so that file can be referenced incase upload is paused and needs to be restarted.
    [AWSS3TransferUtilityDatabaseHelper insertMultiPartUploadRequestSubTaskInDB:transferUtilityMultiPartUploadTask subTask:subTask
databaseQueue:self.databaseQueue];
} else {
    //Abort the request, so the server can clean up any partials.
    [self callAbortMultiPartForUploadTask:transferUtilityMultiPartUploadTask];
    transferUtilityMultiPartUploadTask.status = AWSS3TransferUtilityTransferStatusError;
    //Add it to list of completed Tasks
    [self.completedTaskDictionary setObject:transferUtilityMultiPartUploadTask forKey:transferUtilityMultiPartUploadTask.transferID];
    //Clean up.
    [self cleanupForMultiPartUploadTask:transferUtilityMultiPartUploadTask];
    return [AWSTask taskWithError:subTaskCreationError];
}

@harsh62 harsh62 requested a review from brennanMKE September 28, 2021 20:44
@brennanMKE
Copy link
Contributor

LGTM

brennanMKE
brennanMKE previously approved these changes Oct 4, 2021
@harsh62 harsh62 merged commit 86342b7 into main Oct 4, 2021
@harsh62 harsh62 deleted the bugfix/1697 branch October 4, 2021 17:56
gabek pushed a commit to KeepSafe/aws-sdk-ios that referenced this pull request Aug 31, 2023
* fix: absolute paths not working in sandbox and not automatically resuming upload tasks that were pending upon app kill/restart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants