configure how often upload progress is sent trough JS bridge.
sending data too frequently, when tracking several big uploads, can affect the performance of the app, would be great to have a `progressUpdateInterval' option .
I think the main problem is we have too many file access for AsyncStorage, it will write file for each progress event.
The progressUpdateInterval would be make sense, it can solve these problems. I'll come back for this project if I completed my backend work. 😂
We could actually just have an option to disable the progress event emitter all together? I feel like it wouldn't be wise to throttle the error or state changed event emitters.
I can mock this up and submit a PR soon enough
What about creating a separate issue for disabling the progress event emitter ? I see disabling could be useful for some use cases, but still when you need to show a progress bar, you don't want to get so frequent updates. Have a look to react-native-audio and how they solve this problem using CADisplayLink addRunLoop , configured to 250ms ( I wouldn't hardcoded it)
About errors I agree the shouldn't be throttled, but sent in a separated event, in that way you could have progress every X time, and errors as soon as they happen.
s3.on('progress', (data) => { } )
s3.on('error', (error) => {} )
@jhen0409 If you're using redux-persist, I suspect that's the cause of the contentious AsyncStorage calls.
We gave up on redux-persist for now, because of this issue, and because there's a bug that prevents it from handing scalars correctly. Ultimately, you only need to write the store to disk before the app exits; this can easily be done with some judicious use of a custom saveStore action that invokes AsyncStorage directly. It's not as sexy as using middleware, but it works.