On Feb 10, 2014, at 8:40 AM, Endika Montejo <[email protected]>
wrote:
> -(void) completeSyncReplication{
> while (([self.pullReplication status] > kCBLReplicationStopped ) &&
> ([self.pushReplication status] > kCBLReplicationStopped )){
> }
> }
Yikes! Never write a loop like that, in any context. It's going to run the CPU
at 100% power while it waits, draining battery like crazy.
It's not a good idea to waiting block for replication to complete. Instead,
trigger the action you're waiting to perform in response to getting a
notification.
If you do have to wait, at least add something like [NSThread sleep: 0.01] in
the body of the loop so it's not continually busy.
--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/6FCD10B6-BA6B-44A5-8E74-C93E8FA99DAF%40couchbase.com.
For more options, visit https://groups.google.com/groups/opt_out.