Created
July 7, 2020 20:44
-
-
Save schmidt-sebastian/48ed97084b74bf7e3dd5936eddbfc001 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/google-cloud-firestore/src/main/java/com/google/cloud/firestore/UpdateBuilder.java b/google-cloud-firestore/src/main/java/com/google/cloud/firestore/UpdateBuilder.java | |
index c15cb67..99ff684 100644 | |
--- a/google-cloud-firestore/src/main/java/com/google/cloud/firestore/UpdateBuilder.java | |
+++ b/google-cloud-firestore/src/main/java/com/google/cloud/firestore/UpdateBuilder.java | |
@@ -64,7 +64,7 @@ public abstract class UpdateBuilder<T> { | |
} | |
final FirestoreImpl firestore; | |
- private final List<WriteOperation> writes; | |
+ protected final List<WriteOperation> writes; | |
private boolean committed; | |
private final int maxBatchSize; | |
diff --git a/google-cloud-firestore/src/main/java/com/google/cloud/firestore/WriteBatch.java b/google-cloud-firestore/src/main/java/com/google/cloud/firestore/WriteBatch.java | |
index ba69ab4..21f9f94 100644 | |
--- a/google-cloud-firestore/src/main/java/com/google/cloud/firestore/WriteBatch.java | |
+++ b/google-cloud-firestore/src/main/java/com/google/cloud/firestore/WriteBatch.java | |
@@ -17,7 +17,12 @@ | |
package com.google.cloud.firestore; | |
import com.google.api.core.ApiFuture; | |
+import com.google.common.base.Predicate; | |
+import com.google.common.collect.FluentIterable; | |
+import org.checkerframework.checker.nullness.compatqual.NullableDecl; | |
+ | |
import java.util.List; | |
+import java.util.Set; | |
import javax.annotation.Nonnull; | |
/** | |
@@ -27,8 +32,16 @@ import javax.annotation.Nonnull; | |
*/ | |
public class WriteBatch extends UpdateBuilder<WriteBatch> { | |
- WriteBatch(FirestoreImpl firestore) { | |
+ WriteBatch(FirestoreImpl firestore, WriteBatch retryBatch, final Set<String> docsToRetry) { | |
super(firestore); | |
+ | |
+ this.writes.addAll( | |
+ FluentIterable.from(retryBatch.writes).filter(new Predicate<WriteOperation>() { | |
+ @Override | |
+ public boolean apply(WriteOperation writeOperation) { | |
+ return docsToRetry.contains(writeOperation.path); | |
+ } | |
+ }).toList()); | |
} | |
/** |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment