Looks like it didn’t quite work. To recap, my app is a react-native app and only uses the REST API. I recently altered it to not use continuous push replication, but instead after each PUT and POST it invokes a one-shot push replication. Last night I got some logs from a device which show that this doesn’t work. I’m not sure why, but maybe you just can’t rely on HTTP when the app is backgrounded?
Here’s what happened, taken from the app logs:
2016-10-03T23:07:47Z app gets backgrounded
2016-10-03T23:07:47Z at the same moment app creates a document (and writes to console.log BEFORE making the PUT request)
2016-10-03T23:07:47Z the new document immediately appears in the changes feed
... time passes, nothing happens (the log is empty)
2016-10-04T06:04:17Z app wakes up in background because it received a push notification (for an unrelated event)
2016-10-04T06:04:17Z the push replication gets invoked
2016-10-04T06:04:17Z the app logs that the the PUT http request (from above) has finished (almost 7 hours later)
... time passes again
2016-10-04T07:30:26Z the push replication finishes
The document is below - you can see large difference between the sync-gateway timestamp and my apps own audit timestamp which shows when it was written the to local CBL db.
So it seems that just by backgrounding the app I managed to prevent it from invoking the push replication somehow.
I have the background modes all set:
And the CBLMamanger is created with option