In CouchbaseLite for Android (v 1.3.1) when I call the LiveQuery.run() method, it takes between 200 to 979 milliseconds to return, while pull replication is taking place at the same time. I’m querying a single document (startKey = endKey) with an all-docs query:
LiveQuery liveQuery = database.createAllDocumentsQuery().toLiveQuery();
liveQuery.setStartKey(myDocKey);
liveQuery.setEndKey(myDocKey);
liveQuery.setIndexUpdateMode(Query.IndexUpdateMode.AFTER);
liveQuery.addChangeListener(new LiveQuery.ChangeListener() {
public void changed(ChangeEvent event) {
//do something with event.getRows()
}
});
// This call takes up to 979 ms to return when pull replication is happening at the same time
QueryEnumerator run = liveQuery.run();
I observed that if instead of using a LiveQuery I use a simple Query object, the run() method doesn’t take long to return. Is there some kind of blocking/thread-synchronization that cause the LiveQuery.run() method to block the call for very long times when pull replication is happening at the same time?