Skip to content

Commit c042d03

Browse files
committed
feat(firestore): support retrieving documents up to 16MB over gRPC watch stream
1 parent 990367e commit c042d03

2 files changed

Lines changed: 10 additions & 0 deletions

File tree

firebase-firestore/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Unreleased
22

3+
- [changed] Increased the gRPC maximum inbound message size limit to 17MB to support downloading Cloud Firestore documents of up to 16MB.
4+
35
# 26.4.0
46

57
- [feature] Added support for `minimum` and `maximum` FieldValue operations.

firebase-firestore/src/main/java/com/google/firebase/firestore/remote/GrpcCallProvider.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,11 @@ public class GrpcCallProvider {
5757
// reconnecting again, rather than waiting up to 2+ minutes for gRPC to timeout.
5858
// More details about usage can be found in GrpcCallProvider.onConnectivityStateChanged().
5959
private static final int CONNECTIVITY_ATTEMPT_TIMEOUT_MS = 15 * 1000;
60+
61+
// This is used to increase the max inbound message size from the 4MB default to 17MB,
62+
// in order to support 16MB docs + overhead.
63+
// https://grpc.github.io/grpc-java/javadoc/io/grpc/okhttp/OkHttpServerBuilder.html#maxInboundMessageSize(int)
64+
private static final int MAX_INBOUND_MESSAGE_SIZE = 17 * 1024 * 1024;
6065
private DelayedTask connectivityAttemptTimer;
6166

6267
private final Context context;
@@ -108,6 +113,9 @@ private ManagedChannel initChannel(Context context, DatabaseInfo databaseInfo) {
108113
// usually notify gRPC when a connection dies. But not always. This acts as a failsafe.)
109114
channelBuilder.keepAliveTime(30, TimeUnit.SECONDS);
110115

116+
// Increase the maximum inbound message size from 4MB to 17MB, to support 16MB docs.
117+
channelBuilder.maxInboundMessageSize(MAX_INBOUND_MESSAGE_SIZE);
118+
111119
// Wrap the ManagedChannelBuilder in an AndroidChannelBuilder. This allows the channel to
112120
// respond more gracefully to network change events (such as switching from cell to wifi).
113121
AndroidChannelBuilder androidChannelBuilder =

0 commit comments

Comments
 (0)