Thanks, yes I will work with observes... really much better

On Monday, February 10, 2014 7:12:18 PM UTC+1, Jens Alfke wrote:
>
>
> On Feb 10, 2014, at 8:40 AM, Endika Montejo 
> <[email protected]<javascript:>> 
> 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/f71d5f03-5fda-4afd-80b8-1235487ecdbf%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to