Skip to content

Commit 67a5a35

Browse files
committed
work
1 parent fd77d62 commit 67a5a35

File tree

9 files changed

+20
-24
lines changed

9 files changed

+20
-24
lines changed

packages/firestore/src/api/database.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,6 @@ export function configureFirestore(firestore: Firestore): void {
310310
firestore._appCheckCredentials,
311311
firestore._queue,
312312
databaseInfo,
313-
settings.experimentalOptions.sendWriteRequestsDelayMs ?? null,
314313
firestore._componentsProvider &&
315314
buildComponentProvider(firestore._componentsProvider)
316315
);

packages/firestore/src/core/component_provider.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@ export interface ComponentConfiguration {
8585
clientId: ClientId;
8686
initialUser: User;
8787
maxConcurrentLimboResolutions: number;
88-
sendWriteRequestsDelayMs: number | null;
8988
}
9089

9190
export interface OfflineComponentProviderFactory {
@@ -487,7 +486,7 @@ export class OnlineComponentProvider {
487486
OnlineStateSource.RemoteStore
488487
),
489488
newConnectivityMonitor(),
490-
cfg.sendWriteRequestsDelayMs
489+
cfg.databaseInfo.sendWriteRequestsDelayMs
491490
);
492491
}
493492

packages/firestore/src/core/database_info.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ export class DatabaseInfo {
3838
* @param longPollingOptions Options that configure long-polling.
3939
* @param useFetchStreams Whether to use the Fetch API instead of
4040
* XMLHTTPRequest
41+
* @param sendWriteRequestsDelayMs The delay, in milliseconds, to use before
42+
* sending write requests over the wire in remote store.
4143
*/
4244
constructor(
4345
readonly databaseId: DatabaseId,
@@ -48,7 +50,8 @@ export class DatabaseInfo {
4850
readonly forceLongPolling: boolean,
4951
readonly autoDetectLongPolling: boolean,
5052
readonly longPollingOptions: ExperimentalLongPollingOptions,
51-
readonly useFetchStreams: boolean
53+
readonly useFetchStreams: boolean,
54+
readonly sendWriteRequestsDelayMs: number | null
5255
) {}
5356
}
5457

packages/firestore/src/core/firestore_client.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,6 @@ export class FirestoreClient {
140140
*/
141141
public asyncQueue: AsyncQueue,
142142
private databaseInfo: DatabaseInfo,
143-
private sendWriteRequestsDelayMs: number | null,
144143
componentProvider?: {
145144
_offline: OfflineComponentProvider;
146145
_online: OnlineComponentProvider;
@@ -166,8 +165,7 @@ export class FirestoreClient {
166165
authCredentials: this.authCredentials,
167166
appCheckCredentials: this.appCheckCredentials,
168167
initialUser: this.user,
169-
maxConcurrentLimboResolutions: MAX_CONCURRENT_LIMBO_RESOLUTIONS,
170-
sendWriteRequestsDelayMs: this.sendWriteRequestsDelayMs
168+
maxConcurrentLimboResolutions: MAX_CONCURRENT_LIMBO_RESOLUTIONS
171169
};
172170
}
173171

packages/firestore/src/lite-api/components.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ export function makeDatabaseInfo(
119119
settings.experimentalForceLongPolling,
120120
settings.experimentalAutoDetectLongPolling,
121121
cloneLongPollingOptions(settings.experimentalLongPollingOptions),
122-
settings.useFetchStreams
122+
settings.useFetchStreams,
123+
settings.experimental.sendWriteRequestsDelayMs ?? null
123124
);
124125
}

packages/firestore/src/lite-api/settings.ts

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ export interface PrivateSettings extends FirestoreSettings {
9090
experimentalLongPollingOptions?: ExperimentalLongPollingOptions;
9191
useFetchStreams?: boolean;
9292
emulatorOptions?: { mockUserToken?: EmulatorMockTokenOptions | string };
93-
experimentalOptions?: ExperimentalOptions;
93+
experimental?: ExperimentalOptions;
9494

9595
localCache?: FirestoreLocalCache;
9696
}
@@ -119,7 +119,7 @@ export class FirestoreSettingsImpl {
119119

120120
readonly useFetchStreams: boolean;
121121
readonly localCache?: FirestoreLocalCache;
122-
readonly experimentalOptions: ExperimentalOptions;
122+
readonly experimental: ExperimentalOptions;
123123

124124
// Can be a google-auth-library or gapi client.
125125
// eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -188,10 +188,8 @@ export class FirestoreSettingsImpl {
188188

189189
this.useFetchStreams = !!settings.useFetchStreams;
190190

191-
this.experimentalOptions = cloneExperimentalOptions(
192-
settings.experimentalOptions ?? {}
193-
);
194-
validateExperimentalOptions(this.experimentalOptions);
191+
this.experimental = cloneExperimentalOptions(settings.experimental ?? {});
192+
validateExperimentalOptions(this.experimental);
195193
}
196194

197195
isEqual(other: FirestoreSettingsImpl): boolean {
@@ -210,10 +208,7 @@ export class FirestoreSettingsImpl {
210208
) &&
211209
this.ignoreUndefinedProperties === other.ignoreUndefinedProperties &&
212210
this.useFetchStreams === other.useFetchStreams &&
213-
experimentalOptionsEqual(
214-
this.experimentalOptions,
215-
other.experimentalOptions
216-
)
211+
experimentalOptionsEqual(this.experimental, other.experimental)
217212
);
218213
}
219214
}

packages/firestore/test/integration/util/internal_helpers.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@ export function getDefaultDatabaseInfo(): DatabaseInfo {
6161
cloneLongPollingOptions(
6262
DEFAULT_SETTINGS.experimentalLongPollingOptions ?? {}
6363
),
64-
/*use FetchStreams= */ false
64+
/*use FetchStreams= */ false,
65+
/*sendWriteRequestsDelayMs= */ null
6566
);
6667
}
6768

packages/firestore/test/unit/remote/rest_connection.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,8 @@ describe('RestConnection', () => {
6767
/*forceLongPolling=*/ false,
6868
/*autoDetectLongPolling=*/ false,
6969
/*longPollingOptions=*/ {},
70-
/*useFetchStreams=*/ false
70+
/*useFetchStreams=*/ false,
71+
/*sendWriteRequestsDelayMs= */ null
7172
);
7273
const connection = new TestRestConnection(testDatabaseInfo);
7374

packages/firestore/test/unit/specs/spec_test_runner.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,8 @@ abstract class TestRunner {
283283
/*forceLongPolling=*/ false,
284284
/*autoDetectLongPolling=*/ false,
285285
/*longPollingOptions=*/ {},
286-
/*useFetchStreams=*/ false
286+
/*useFetchStreams=*/ false,
287+
config.sendWriteRequestsDelayMs ?? null
287288
);
288289

289290
// TODO(mrschmidt): During client startup in `firestore_client`, we block
@@ -300,7 +301,6 @@ abstract class TestRunner {
300301
this.useEagerGCForMemory = config.useEagerGCForMemory;
301302
this.numClients = config.numClients;
302303
this.maxConcurrentLimboResolutions = config.maxConcurrentLimboResolutions;
303-
this.sendWriteRequestsDelayMs = config.sendWriteRequestsDelayMs;
304304
this.expectedActiveLimboDocs = [];
305305
this.expectedEnqueuedLimboDocs = [];
306306
this.expectedActiveTargets = new Map<TargetId, ActiveTargetSpec>();
@@ -318,8 +318,7 @@ abstract class TestRunner {
318318
clientId: this.clientId,
319319
initialUser: this.user,
320320
maxConcurrentLimboResolutions:
321-
this.maxConcurrentLimboResolutions ?? Number.MAX_SAFE_INTEGER,
322-
sendWriteRequestsDelayMs: this.sendWriteRequestsDelayMs ?? null
321+
this.maxConcurrentLimboResolutions ?? Number.MAX_SAFE_INTEGER
323322
} satisfies ComponentConfiguration;
324323

325324
this.connection = new MockConnection(this.queue);

0 commit comments

Comments
 (0)