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 (#10157)
This commit is contained in:
@@ -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));
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user