fix: LiveQuery regexTimeout default value not applied (#10157)

This commit is contained in:
Manuel
2026-03-09 18:07:12 +00:00
committed by GitHub
parent 01fad124d4
commit 94c4f523e0
2 changed files with 24 additions and 0 deletions
+10
View File
@@ -543,6 +543,16 @@ describe('matchesQuery', function () {
expect(matchesQuery(player, q)).toBe(true);
});
it('applies default regexTimeout when liveQuery is configured without explicit regexTimeout', async () => {
await reconfigureServer({
liveQuery: { classNames: ['Player'] },
});
// Verify the default value is applied by checking the config
const Config = require('../lib/Config');
const config = Config.get('test');
expect(config.liveQuery.regexTimeout).toBe(100);
});
it('matches $nearSphere queries', function () {
let q = new Parse.Query('Checkin');
q.near('location', new Parse.GeoPoint(20, 20));
+14
View File
@@ -13,6 +13,7 @@ import {
DatabaseOptions,
FileUploadOptions,
IdempotencyOptions,
LiveQueryOptions,
LogLevels,
PagesOptions,
ParseServerOptions,
@@ -134,6 +135,7 @@ export class Config {
databaseOptions,
extendSessionOnUse,
allowClientClassCreation,
liveQuery,
}) {
if (masterKey === readOnlyMasterKey) {
throw new Error('masterKey and readOnlyMasterKey should be different');
@@ -176,6 +178,7 @@ export class Config {
this.validateDatabaseOptions(databaseOptions);
this.validateCustomPages(customPages);
this.validateAllowClientClassCreation(allowClientClassCreation);
this.validateLiveQueryOptions(liveQuery);
}
static validateCustomPages(customPages) {
@@ -669,6 +672,17 @@ export class Config {
}
}
static validateLiveQueryOptions(liveQuery) {
if (liveQuery == undefined) {
return;
}
if (liveQuery.regexTimeout === undefined) {
liveQuery.regexTimeout = LiveQueryOptions.regexTimeout.default;
} else if (typeof liveQuery.regexTimeout !== 'number') {
throw `liveQuery.regexTimeout must be a number`;
}
}
static validateRateLimit(rateLimit) {
if (!rateLimit) {
return;