LiveQuery.run() slow during pull replication

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?

Tagging @hideki - Weren’t you looking into a similar latency issue this past week? Was that in 1.4?

Hi @everardo.x.vargas_nd

We will track this item with the github ticket. https://github.com/couchbase/couchbase-lite-java-core/issues/1642 .

Thanks,
Hideki