Hi Jens,

I would like to ask you one question.

I am working in my Mac app (I build in here the couchbase framework) and 
even though the replication is done I find several unexpected behaviours:

- When I create the replication I don't start the pusher and the puller, 
but the replication works. (From what I have read the replication must be 
started)
- Even when I stop asynchronously the replication, it keeps working.
- In the observer I log the completedChangesCount and changesCount of both 
pusher and puller and I always get a 0 in both properties.

Here you have my code (with the start method commented):

http://pastie.org/private/sajsntzy8ii7qlpmajdng

Notice in the observer I should append into the if's "&& 
self.xxxreplication completedChangesCount >0, but as I have said it always 
log me a 0.

Thanks a lot!

On Monday, February 10, 2014 7:51:39 PM UTC+1, Endika Montejo wrote:
>
> 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]> 
>> 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/331998e9-e1ce-4312-b4d7-66102bfbfa2c%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to