Skip to content

Commit e8debe3

Browse files
committed
fix concurrency bug
1 parent 63e66cd commit e8debe3

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

firebase-firestore/src/main/java/com/google/firebase/firestore/local/SQLiteRemoteDocumentCache.java

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -143,10 +143,8 @@ public Map<DocumentKey, MutableDocument> getAll(
143143
.performNextSubquery()
144144
.forEach(
145145
row -> {
146-
QueryContext singleCounter = new QueryContext();
147-
processRowInBackground(
148-
backgroundQueue, results, row, /*filter*/ null, singleCounter);
149-
counter.fullScanCount += singleCounter.fullScanCount;
146+
processRowInBackground(backgroundQueue, results, row, /*filter*/ null);
147+
counter.fullScanCount++;
150148
});
151149
}
152150
backgroundQueue.drain();
@@ -234,8 +232,8 @@ private Map<DocumentKey, MutableDocument> getAll(
234232
.forEach(
235233
row -> {
236234
QueryContext singleCounter = new QueryContext();
237-
processRowInBackground(backgroundQueue, results, row, filter, singleCounter);
238-
counter.fullScanCount += singleCounter.fullScanCount;
235+
processRowInBackground(backgroundQueue, results, row, filter);
236+
counter.fullScanCount++;
239237
});
240238
backgroundQueue.drain();
241239
return results;
@@ -253,8 +251,7 @@ private void processRowInBackground(
253251
BackgroundQueue backgroundQueue,
254252
Map<DocumentKey, MutableDocument> results,
255253
Cursor row,
256-
@Nullable Function<MutableDocument, Boolean> filter,
257-
QueryContext counter) {
254+
@Nullable Function<MutableDocument, Boolean> filter) {
258255
byte[] rawDocument = row.getBlob(0);
259256
int readTimeSeconds = row.getInt(1);
260257
int readTimeNanos = row.getInt(2);
@@ -266,7 +263,6 @@ private void processRowInBackground(
266263
() -> {
267264
MutableDocument document =
268265
decodeMaybeDocument(rawDocument, readTimeSeconds, readTimeNanos);
269-
counter.fullScanCount++;
270266
if (filter == null || filter.apply(document)) {
271267
synchronized (results) {
272268
results.put(document.getKey(), document);

0 commit comments

Comments
 (0)