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

What to do when navigator goes offline ? #638

Open
clochix opened this issue Apr 15, 2014 · 5 comments
Open

What to do when navigator goes offline ? #638

clochix opened this issue Apr 15, 2014 · 5 comments

Comments

@clochix
Copy link
Contributor

clochix commented Apr 15, 2014

When navigator goes offline, sync request fails, emit an error message, and then try again to sync, until it works.

This seems reasonable, but if the error are logged, this may result in lot of log messages.

I got around this issue by calling stopSync() when navigator goes offline, and not logging errors when offline, but I wonder if we shouldn't wait a little bit before trying again to sync on network failure. Wait 5s, then 10s… 60s.

@raucao
Copy link
Member

raucao commented Apr 15, 2014

Yes, that makes total sense. I thought it was already kind of like that.

@michielbdejong
Copy link
Member

this was fixed in #665, thanks a lot @clochix for working on that! we rebased your PR and merged it a couple of days ago.

@raucao
Copy link
Member

raucao commented May 13, 2014

The merged PR was for the app being in the background via the Page Visibility API, not for going offline (which is a bit hairy, because navigator.online is not exactly the most reliable Web API).

@michielbdejong
Copy link
Member

ah but we're already detecting that, and reducing sync.numThreads from 5 to 1 in that case. It would be a one-liner to also switch to the background sync interval in that case (and maybe rename it because it would then be "background or offline"

@raucao
Copy link
Member

raucao commented May 13, 2014

We could also just alias the property and have a nice name in both cases.

@raucao raucao removed the easy label Nov 1, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants