Thanks Jens, Good to know. The issue I have is that the UI is getting blocked during very large replications (iOS). 30,000 documents each with a small binary attachment. The UI freezes/slows even on the simulator. Is there a way around this? Can the replication run on a lower priority thread?
On Tuesday, 2 January 2018 17:52:37 UTC, Jens Alfke wrote: > > > > On Dec 29, 2017, at 7:40 AM, Adam Wilson <[email protected] > <javascript:>> wrote: > > I've added an option to a library > <https://github.com/adamski/react-native-couchbase> I'm using to > replicate on a background thread. > > > This isn’t necessary: replication already runs on a background thread. The > CBLReplication class just sends messages to the background replicator and > relays notifications from it, so all CBLReplication methods return > immediately. > > TL;DR: Just use CBLReplication on the main database; it’s asynchronous and > won’t block your main thread. > > There are a couple problems with the code you showed. > > - Using CBLReplication inside the background block probably won’t > work, basically because the background database (`bgdb`) is itself the > database instance that runs the real replicator work. Trying to predict > what would happen is making my head hurt; simpler just to say Don’t do > that. > - The call to `[[NSRunLoop currentRunLoop] run]` will block forever, > preventing the background database from handling any more requests. Don’t > do that either :) > > > —Jens > -- You received this message because you are subscribed to the Google Groups "Couchbase Mobile" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/mobile-couchbase/dd9d0eeb-d600-4a8b-bdd6-152697ffc322%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
