Webhook called twice with shadowing


#1

I’m prototyping a couchbase solution for a fairly typical mobile app with multiple mobile (Android) clients connecting to a single server. The server database is writable since there is back end logic that is executed, so I’ve setup shadowing. My SG config is below.

The problem that I am having is that enabling shadow causes two calls to the webhook. Here is a log from the server handling the webhook. You see the document is posted twice, the first time with extra metadata attached. The second time, three seconds later, it is just the document as sent from the mobile client.

> 12:22:34:462 [info] c.HomeController - Couchbase with {"_id":"b92626c2-d9fc-4884-a8a4-dada1ac1c591","_rev":"1-291943202d2a2cb85c66754262d155c7","_revisions":{"ids":["291943202d2a2cb85c66754262d155c7"],"start":1},"status":"process","timstamp":1445502916631}
> 12:22:37:458 [info] c.HomeController - Couchbase with {"_id":"b92626c2-d9fc-4884-a8a4-dada1ac1c591","_rev":"1-291943202d2a2cb85c66754262d155c7","status":"process","timstamp":1445502916631}

Does anybody know what is going on? As you can imagine, this is not desirable. I could theoretically add logic to the sync function to ignore documents without the extra metadata (the one with the metadata shows up first, and a user is waiting for the result of the back end processing), but this is not ideal and I don’t know whether it is even reliable.