mirror of
https://github.com/ajayyy/SponsorBlockServer.git
synced 2025-12-14 15:37:07 +03:00
Allow disabling redis rate limit
This commit is contained in:
@@ -147,6 +147,7 @@ addDefaults(config, {
|
||||
disableOfflineQueue: true,
|
||||
weight: 1
|
||||
},
|
||||
redisRateLimit: true,
|
||||
patreon: {
|
||||
clientId: "",
|
||||
clientSecret: "",
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -67,6 +67,7 @@ export interface SBSConfig {
|
||||
maximumPrefix?: string;
|
||||
redis?: RedisConfig;
|
||||
redisRead?: RedisReadOnlyConfig;
|
||||
redisRateLimit: boolean;
|
||||
maxRewardTimePerSegmentInSeconds?: number;
|
||||
postgres?: CustomPostgresConfig;
|
||||
postgresReadOnly?: CustomPostgresReadOnlyConfig;
|
||||
|
||||
Reference in New Issue
Block a user