aws-amplify / amplify-android

The fastest and easiest way to use AWS from your Android app.
https://docs.amplify.aws/lib/q/platform/android/
Apache License 2.0
249 stars 117 forks source link

[Storage]: Multi-part upload results in many progress updates with 100% status #2869

Open mattcreaser opened 4 months ago

mattcreaser commented 4 months ago

Before opening, please confirm:

Language and Async Model

Kotlin

Amplify Categories

Storage

Gradle script dependencies

```groovy // Put output below this line ```

Environment information

``` # Put output below this line ```

Please include any relevant guides or documentation you're referencing

No response

Describe the bug

When uploading a file over 5mb Amplify performs a multi-part upload. When this upload completes there are multiple progress updates sent in a burst with a completion percentage of 100%. The number of such updates appears to be proportional to the size of the file - for a file measuring 472mb, I noted that this resulted in several hundred callbacks.

There should only be one progress update sent with a completion percentage of 100%.

Reproduction steps (if applicable)

  1. Create an app that can upload a file to S3 with Amplify
  2. Attempt to upload a file that is >= 5mb. This will result in a multi-part upload.
  3. Observe the progress updates received. Note that there are multiple callbacks with progress == 1.0. The larger the file, the higher the number of such callbacks received.

Code Snippet

Amplify.Storage.uploadFile(
    StoragePath.fromString(path), 
    file, 
    StorageUploadFileOptions.defaultInstance(),
    { Log.i("MyAmplifyApp", "Fraction completed: ${it.fractionCompleted} (${it.currentBytes} / ${it.totalBytes})") },
    { Log.i("MyAmplifyApp", "Successfully uploaded: ${it.path}") },
    { Log.e("MyAmplifyApp", "Upload failed", it) }
)

Log output

``` // Put your logs below this line ```

amplifyconfiguration.json

No response

GraphQL Schema

```graphql // Put your schema below this line ```

Additional information and screenshots

No response