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

This commit is contained in:
Manuel
2026-03-09 18:03:17 +00:00
committed by GitHub
parent 00c6c7c7d1
commit 416cfbcd73
2 changed files with 24 additions and 0 deletions
+10
View File
@@ -557,6 +557,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
@@ -14,6 +14,7 @@ import {
DatabaseOptions,
FileUploadOptions,
IdempotencyOptions,
LiveQueryOptions,
LogLevels,
PagesOptions,
ParseServerOptions,
@@ -136,6 +137,7 @@ export class Config {
extendSessionOnUse,
allowClientClassCreation,
requestComplexity,
liveQuery,
}) {
if (masterKey === readOnlyMasterKey) {
throw new Error('masterKey and readOnlyMasterKey should be different');
@@ -179,6 +181,7 @@ export class Config {
this.validateCustomPages(customPages);
this.validateAllowClientClassCreation(allowClientClassCreation);
this.validateRequestComplexity(requestComplexity);
this.validateLiveQueryOptions(liveQuery);
}
static validateCustomPages(customPages) {
@@ -706,6 +709,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;