Hello,
I have an iOS Titanium client built using the couchbaseLite titanium iOS module. Pull and Push replication is configured and working well in general, however I noticed a problem. If I update the same json document via the sync gateway using a REST PUT command two times in a row, the second time the document is updated, the CHANGE_EVENT is not received in the javascript listener callback. I see that the emitter map is accessed but the callback is not invoked. If I update another different document after updating a first document, then I can receive the CHANGE_EVENT successfully in the callback each time. It’s only when I try to update the SAME document two times in succession that I do not get the CHANGE_EVENT. Tomorrow I’m going to begin to try to see some logging information about why this is happening. Any ideas or tips on how to see the logs for this? Does it sound like this might be an issue in the Titanium IOS module, or possibly the iOS CouchbaseLite code or maybe the sync_gateway?
Thanks for any insight and help.
By design we’ll coalesce multiple updates to the same document into a single change event (unless your change consumer is very fast). Is the version you see associated with the change event, the latest version of the doc?
If you are only getting the oldest version of the doc, instead of the newest, then that is a bug.
Also you might be able to get more Titanium users looking at your question if you post it to our Google Group
Thank you,
I posed there as well.
The updates to the data are done by hand slowly. I receive a CHANGE_EVENT in my code, and after I’ve seen that then I’m updating the data again so I’m not sure about coalescing the changes in a single change event. What do you think?
Here is how I see this issue: In a terminal I run curl -u user:password -X GET http://myhost.compute-1.amazonaws.com:4984/sync_gateway/session:100
. This returns my data like this: {"_id":“session:100”,"_rev":“25-e6f75cb8c030d7cf660fcfbb6b1d5a35”,“ab”:“JS _proto”,“title”:“Prototyping JS The Right Way”,“type”:“session”}
Next I update the data with using the same _rev number in a PUSH like this: curl -X PUT -H ‘Content-Type: application/json’ http://user:password@myhost.compute-1.amazonaws.com:4984/sync_gateway/session:100 -d ‘{“title”:“Name Change - Prototyping JS The Only Way”, “type”:“session”, “ab”:“JS _proto”, “_rev”:“25-e6f75cb8c030d7cf660fcfbb6b1d5a35”}’
The update works great and in my debugger I receive the CHANGE_EVENT in my code. If I repeat the same process again and get the new revision number and update the data to have a different title I do not receive the CHANGE_EVENT in my code. Each time however I can see in the debugger that my emitter mapping code is processed.