dexie / Dexie.js

A Minimalistic Wrapper for IndexedDB
https://dexie.org
Apache License 2.0
11.34k stars 640 forks source link

Cloud: When the device goes offline, the errors pile up. Can the cloud stop sync & ws connection when there is no internet? #1974

Open oyalhi opened 4 months ago

oyalhi commented 4 months ago

As the title suggests. When we take the device offline, the errors start to pile up. So much so that chrome devtools becomes unresponsive and safari devtools connected to an actual device just crashes and closes.

Alternatively, is there a best practice we should be following when the device is offline in terms of dexie cloud?

ScreenShot 2024-05-01 at 08 10 53@2x

dfahlander commented 4 months ago

I can repeat the following. Don't know if that corresponds to what you are experiencing...

  1. I open an application (dexie cloud todo sample app)
  2. Switch off my wifi connection
  3. Get the websocket error in the console only if I am active in the application and at most every 3rd second if I am constantly active with mouse or keyboard.
  4. If I stop being active (not use keyboard or mouse in application), error stops logging.
  5. If I start being active, error comes again but not more often than every 3rd second

To me this does not end up in some state that locks the application or goes into any endless loop. Is this the same in your case or do you experience more frequent logs than every 3rd second at most?

I am on a macbook with chrome devtools but I can't reproduce the devtools becoming unresponsive.

Could your situation be reproducable with your app and computer with chrome / devtools?

oyalhi-mgm commented 4 months ago

Just checked dexie cloud todo sample app. The behavior is very different than what I'm observing with our app.

It might be related to the 2 web workers we have. Without having any interaction we seem to get into endless loop. Not sure what's causing it. Workers are meant to run once on an update to a transaction. Our app is a PWA if that matters.

Here is a short video showing the error, around 29second mark after we update a record issue is more observable: https://share.cleanshot.com/zVy77NTX