Allow disabling redis rate limit

This commit is contained in:
Ajay 2022-10-27 16:50:35 -04:00
parent c2acc6227b
commit ccd1321d24
3 changed files with 4 additions and 1 deletions

View file

@ -147,6 +147,7 @@ addDefaults(config, {
disableOfflineQueue: true,
weight: 1
},
redisRateLimit: true,
patreon: {
clientId: "",
clientSecret: "",

View file

@ -32,7 +32,8 @@ export function rateLimitMiddleware(limitConfig: RateLimitConfig, getUserID?: (r
}
},
store: config.redis?.enabled ? new RedisStore({
sendCommand: (...args: string[]) => redis.sendCommand(args).catch((err) => Logger.error(err)) as Promise<RedisReply>,
sendCommand: (...args: string[]) => config.redisRateLimit ? redis.sendCommand(args).catch((err) => Logger.error(err)) as Promise<RedisReply>
: Promise.resolve(null) as Promise<RedisReply>,
}) : null,
});
} catch (e) {

View file

@ -67,6 +67,7 @@ export interface SBSConfig {
maximumPrefix?: string;
redis?: RedisConfig;
redisRead?: RedisReadOnlyConfig;
redisRateLimit: boolean;
maxRewardTimePerSegmentInSeconds?: number;
postgres?: CustomPostgresConfig;
postgresReadOnly?: CustomPostgresReadOnlyConfig;