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

Issue with bad connectivity #375

Open
mlecoq opened this issue Mar 19, 2019 · 2 comments
Open

Issue with bad connectivity #375

mlecoq opened this issue Mar 19, 2019 · 2 comments
Labels
feature-request Have an idea, share it with us!

Comments

@mlecoq
Copy link

mlecoq commented Mar 19, 2019

I am using AppSync with React Native / Expo to have offline capabilities.

It works fine when I switch off/on internet access on my phone.

Nevertheless, when I switch back on to be connected to a wifi with no internet connection, my application slow down and becomes unusable.

AppSync seems to try to send many times stored mutations and causes this issue.
When I look into the code, I see that AppSync is based on redux-offline and retries a factor of 100 ms.

const getDelay = count => ((2 ** count) * BASE_TIME_MS) + (JITTER_FACTOR * Math.random());

By default Redux offline is less eager.
Its default implementation uses the following schedule to retry requets:

After 1 seconds
After 5 seconds
After 15 seconds
After 30 seconds
After 1 minute
After 3 minutes
After 5 minutes
After 10 minutes
After 30 minutes
After 1 hour

We would like to configure network detection. When we look in redux-offline configuration, there is a detectNetwork method that can be used :

https://github.com/redux-offline/redux-offline/blob/develop/docs/api/config.md#detectnetwork

I have seen a pull request for this ( #99 ). But it has not been merged.

After contacting AWS Support, the proposed solution is to use retryDelayOptions and customBackoff from AWS SDK.

What is the proper way to handle this issue ?

Thanks

@manueliglesias manueliglesias added the feature-request Have an idea, share it with us! label Mar 20, 2019
@manueliglesias
Copy link
Contributor

Hi @mlecoq

I am going to label this as a feature request, we've been slowly exposing more control over this kind of stuff (e.g. cvustom storage engines for redux-persist) and exposing a way to customize online detection sounds like a useful addition

@justinmakaila
Copy link

@manueliglesias something like this could be achieved by exposing the offlineStateLens that redux-offline exposes, I think.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request Have an idea, share it with us!
Projects
None yet
Development

No branches or pull requests

3 participants