mirror of
https://github.com/maxlerebourg/crowdsec-bouncer-traefik-plugin.git
synced 2026-07-21 19:48:59 +02:00
81 bug stream mode stops blocking (#82)
* ✨ fix isHealthy issue at startup * 🍱 not added in first commit ? * 🍱 remove unused import * 🍱 fix lint * fix: lint
This commit is contained in:
Vendored
+7
-1
@@ -16,6 +16,9 @@ const (
|
||||
cacheNoBannedValue = "f"
|
||||
)
|
||||
|
||||
// CacheMiss error string when cache is miss.
|
||||
const CacheMiss = "cache:miss"
|
||||
|
||||
//nolint:gochecknoglobals
|
||||
var (
|
||||
redis simpleredis.SimpleRedis
|
||||
@@ -30,7 +33,7 @@ func (localCache) getDecision(clientIP string) (bool, error) {
|
||||
if isCached && isValid && len(bannedString) > 0 {
|
||||
return bannedString == cacheBannedValue, nil
|
||||
}
|
||||
return false, fmt.Errorf("cache:miss")
|
||||
return false, fmt.Errorf(CacheMiss)
|
||||
}
|
||||
|
||||
func (localCache) setDecision(clientIP string, value string, duration int64) {
|
||||
@@ -49,6 +52,9 @@ func (redisCache) getDecision(clientIP string) (bool, error) {
|
||||
if err == nil && len(bannedString) > 0 {
|
||||
return bannedString == cacheBannedValue, nil
|
||||
}
|
||||
if err.Error() == simpleredis.RedisMiss {
|
||||
return false, fmt.Errorf(CacheMiss)
|
||||
}
|
||||
return false, err
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user