Skip to content

Commit 0ad05e8

Browse files
committed
fix
1 parent 00c6c7c commit 0ad05e8

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

spec/QueryTools.spec.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -557,6 +557,16 @@ describe('matchesQuery', function () {
557557
expect(matchesQuery(player, q)).toBe(true);
558558
});
559559

560+
it('applies default regexTimeout when liveQuery is configured without explicit regexTimeout', async () => {
561+
await reconfigureServer({
562+
liveQuery: { classNames: ['Player'] },
563+
});
564+
// Verify the default value is applied by checking the config
565+
const Config = require('../lib/Config');
566+
const config = Config.get('test');
567+
expect(config.liveQuery.regexTimeout).toBe(100);
568+
});
569+
560570
it('matches $nearSphere queries', function () {
561571
let q = new Parse.Query('Checkin');
562572
q.near('location', new Parse.GeoPoint(20, 20));

src/Config.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import {
1414
DatabaseOptions,
1515
FileUploadOptions,
1616
IdempotencyOptions,
17+
LiveQueryOptions,
1718
LogLevels,
1819
PagesOptions,
1920
ParseServerOptions,
@@ -136,6 +137,7 @@ export class Config {
136137
extendSessionOnUse,
137138
allowClientClassCreation,
138139
requestComplexity,
140+
liveQuery,
139141
}) {
140142
if (masterKey === readOnlyMasterKey) {
141143
throw new Error('masterKey and readOnlyMasterKey should be different');
@@ -179,6 +181,7 @@ export class Config {
179181
this.validateCustomPages(customPages);
180182
this.validateAllowClientClassCreation(allowClientClassCreation);
181183
this.validateRequestComplexity(requestComplexity);
184+
this.validateLiveQueryOptions(liveQuery);
182185
}
183186

184187
static validateCustomPages(customPages) {
@@ -706,6 +709,17 @@ export class Config {
706709
}
707710
}
708711

712+
static validateLiveQueryOptions(liveQuery) {
713+
if (liveQuery == undefined) {
714+
return;
715+
}
716+
if (liveQuery.regexTimeout === undefined) {
717+
liveQuery.regexTimeout = LiveQueryOptions.regexTimeout.default;
718+
} else if (typeof liveQuery.regexTimeout !== 'number') {
719+
throw `liveQuery.regexTimeout must be a number`;
720+
}
721+
}
722+
709723
static validateRateLimit(rateLimit) {
710724
if (!rateLimit) {
711725
return;

0 commit comments

Comments
 (0)