Open godehardt opened 6 years ago
Hi!
I experienced the same issue but without pouchdb-react-native. PouchDB throw an ETIMEDOUT too but it's not caused by the library but by the mobile/OS. iOS has a limit of 4 connections on the same host, and I think it came from that. Removing the {live: true} and syncing manually is working.
Hi!
I experienced the same issue but without pouchdb-react-native. PouchDB throw an ETIMEDOUT too but it's not caused by the library but by the mobile/OS. iOS has a limit of 4 connections on the same host, and I think it came from that. Removing the {live: true} and syncing manually is working.
What solutions are you using when you want to sync more than 4 databases ? You sync manually with some timer ?
iOS has a limit of 4 connections on the same host, and I think it came from that.
And why does it has a limit of 4 connections ? Is this iOS? The PouchDB lib? This RN port ?
cc @stockulus and @Dallas62
Hi!
I just find this: https://stackoverflow.com/questions/35715790/in-ios-how-can-we-increase-http-connection-limit-per-host
But not tested.
My solution was:
I made a kind of "queue", at first, place all your collections in this queue, then sync same one by one and replay the queue. You can lower overhead by adding some delay.
Then you should be able to create a more intelligent system like:
Sync this collection every Xs, this one Ys, ... and find the right way to sync same manually. Does every collection need to be synchronized ? or some data do not change to often.
I also added a "force sync" to be sure data are saved when a user made changes but there is no magic way with this limitation (iOS).
Hope it will help you.
We found a mysterious behavior by investigating some trouble we had. After a lot of debugging we boiled it down to the number of databases we want to sync with a couchdb instance.
Below you'll find a minimal example: https://www.dropbox.com/sh/71r0jkdi05e58zx/AABtzR2kEESYYnQIib99Wlg4a?dl=0
Here are the steps to reproduce the behavior (also described in readme.txt):
In folder Test_Pouch_Sync: (1) npm install (2) react-native link 4a. Start Project in Emulator/on Device in Debugging mode e.g. react-native run-android 5a. run "node TestUpdates.js" in other shell/command prompt each time, one attribute in DB test1 will be changed the changes should be triggered inside app as well)
Now Delete return in line 67 of index.android.js (5 DBs synced instead of only 3) 4b. Start Project in Emulator/on Device in Debugging mode e.g. react-native run-android 5b. run "node TestUpdates.js" in other shell/command prompt each time, one attribute in DB test1 will be changed. Change event is no longer triggered inside app. Instead we get: CustomPouchError {code: "ETIMEDOUT", status: 0, docId: "_local/pJITKVlq12xx5VD44sPWHg%3D%3D", result: Object}
Note: The error does not occur in PouchDB (not react-native)! SimulateSyncs.js contains pretty much the same code than the RN app. run "node SimulateSyncs.js" instead of the app to test. Here, all changes trigger an event, even when 5 DBs are synced.