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

configure how often upload progress is sent trough JS bridge. #17

Open
alfonsodev opened this issue Jul 13, 2016 · 4 comments
Open

configure how often upload progress is sent trough JS bridge. #17

alfonsodev opened this issue Jul 13, 2016 · 4 comments

Comments

@alfonsodev
Copy link

sending data too frequently, when tracking several big uploads, can affect the performance of the app, would be great to have a `progressUpdateInterval' option .

@jhen0409
Copy link
Member

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. 😂

@joelwass
Copy link

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

@alfonsodev
Copy link
Author

alfonsodev commented Jul 28, 2016

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) => {} ) 

@tomprogers
Copy link

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants