mirror of
https://github.com/bitwarden/server.git
synced 2024-11-25 12:45:18 +01:00
Catch redis connection exception (#3582)
* Handle RedisConnectionException * Log warning on exception
This commit is contained in:
parent
343cf03d3e
commit
699b884441
@ -66,9 +66,10 @@ public class CustomRedisProcessingStrategy : RedisProcessingStrategy
|
||||
{
|
||||
return await base.ProcessRequestAsync(requestIdentity, rule, counterKeyBuilder, rateLimitOptions, cancellationToken);
|
||||
}
|
||||
catch (RedisTimeoutException)
|
||||
catch (Exception ex) when (ex is RedisTimeoutException || ex is RedisConnectionException)
|
||||
{
|
||||
// If this is the first timeout we've had, start a new counter and sliding window
|
||||
_logger.LogWarning(ex, "Redis appears down, skipping rate limiting");
|
||||
// If this is the first timeout/connection error we've had, start a new counter and sliding window
|
||||
timeoutCounter ??= new TimeoutCounter()
|
||||
{
|
||||
Count = 0,
|
||||
|
Loading…
Reference in New Issue
Block a user