mirror of
https://github.com/parse-community/parse-server
synced 2026-08-09 13:03:18 +00:00
fix: LiveQuery regexTimeout default value not applied (#10156)
This commit is contained in:
@@ -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,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;
|
||||
|
||||
Reference in New Issue
Block a user