aws-amplify / aws-amplify/amplify-android

Multi-threads for calling Amplify.Storage.uploadFile method without network connected

Open
#2,318 2 comments 0 reactions 0 assignees View on GitHub
question storage
Dominant language
Java
Stars
287
Forks
132
Avg merge
2d 2h
Merged PRs (30d)
45

Description

### Discussed in https://github.com/aws-amplify/amplify-android/discussions/2305

Originally posted by **waertf** February 23, 2023
I have the condition that I need to call Amplify.Storage.uploadFile within the following worker class:
`public class UploadImageWork extends ListenableWorker{...}`
if I run the upload method in Multi-threads
`
void upload()
{
WorkRequest UploadImageWifiOnlyWorkWorkRequest =
new OneTimeWorkRequest.Builder(UploadImageWork.class).build();
WorkManager
.getInstance(context)
.enqueue(UploadImageWifiOnlyWorkWorkRequest);
}
`
ref [link](https://stackoverflow.com/questions/61972975/workmanager-does-not-run-more-than-20-jobs)
for amplify v2.2.2
1. I saw that the amplify use workmanager to schedule the jobs. If the amplify enqueue jobs are over 20 or over 50 number. What will happen?
2. as for the upper code, is there a side effect of using enqueue nest work in the main process?
3. what is the max not be done job number that can be held by amplify?

for amplify v1.38.0

1. as for the upper code, is there a side effect of using enqueue for many works?
2. what is the max not be done job number that can be held by amplify?

Thanks.

Contributor guide

Open the contributing guide

Research direction

Start with the UploadImageWork ListenableWorker example and the Amplify.Storage.uploadFile calls described in the issue. Review how WorkManager enqueues work when the device is offline and how many pending jobs it permits, then determine the intended behavior for concurrent uploads and queued work. Done requires documented answers or an agreed implementation scope for the three questions.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, java
Domain
cloud, mobile
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.