File tree Expand file tree Collapse file tree 3 files changed +13
-4
lines changed Expand file tree Collapse file tree 3 files changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -38,8 +38,8 @@ export interface ExperimentalOptions {
3838 * _could_ greatly reduce the number of distinct HTTP requests that are used.
3939 *
4040 * The value must be an integer value strictly greater than zero and less than
41- * or equal to 2000 (2 seconds). A value of `200` is a good starting point to
42- * minimize write latency yet still enable a some amount of batching.
41+ * or equal to 10000 (10 seconds). A value of `200` is a good starting point
42+ * to minimize write latency yet still enable some amount of batching.
4343 *
4444 * See https://github.com/firebase/firebase-js-sdk/issues/5971 for rationale
4545 * and background information that motivated this option.
Original file line number Diff line number Diff line change @@ -55,7 +55,9 @@ const MAX_LONG_POLLING_TIMEOUT_SECONDS = 30;
5555// Whether long-polling auto-detected is enabled by default.
5656const DEFAULT_AUTO_DETECT_LONG_POLLING = true ;
5757
58- const MAX_SEND_WRITE_REQUEST_DELAY_MS = 2000 ;
58+ // Set some maximum value for `sendWriteRequestsDelayMs` to avoid it being set
59+ // to a value so large that it appears that write requests are never being sent.
60+ const MAX_SEND_WRITE_REQUEST_DELAY_MS = 10000 ;
5961
6062/**
6163 * Specifies custom configurations for your Cloud Firestore instance.
Original file line number Diff line number Diff line change @@ -764,7 +764,14 @@ function addToWritePipeline(
764764 writeRequestSent : false
765765 } ) ;
766766
767- if ( remoteStoreImpl . sendWriteRequestsDelayMs === null ) {
767+ const writePipelineContainsOnlyUnsentWriteRequests =
768+ remoteStoreImpl . writePipeline . every ( entry => ! entry . writeRequestSent ) ;
769+
770+ if (
771+ remoteStoreImpl . sendWriteRequestsDelayMs === null ||
772+ ( ! canAddToWritePipeline ( remoteStoreImpl ) &&
773+ writePipelineContainsOnlyUnsentWriteRequests )
774+ ) {
768775 remoteStoreImpl . sendWriteRequestsOperation ?. cancel ( ) ;
769776 remoteStoreImpl . sendWriteRequestsOperation = null ;
770777 sendWriteRequestsFromPipeline ( remoteStoreImpl ) ;
You can’t perform that action at this time.
0 commit comments