cache decision in live mode for maximum defaultDecisionTimeout params (#79)

This commit is contained in:
maxlerebourg
2023-01-18 21:03:09 +01:00
committed by GitHub
parent 5b15d6fdc4
commit 4132445a79
3 changed files with 7 additions and 3 deletions
+5 -1
View File
@@ -313,7 +313,11 @@ func handleNoStreamCache(bouncer *Bouncer, remoteIP string) error {
return fmt.Errorf("handleNoStreamCache:parseDuration %w", err)
}
if isLiveMode {
bouncer.cacheClient.SetDecision(remoteIP, true, int64(duration.Seconds()))
durationSecond := int64(duration.Seconds())
if bouncer.defaultDecisionTimeout < durationSecond {
durationSecond = bouncer.defaultDecisionTimeout
}
bouncer.cacheClient.SetDecision(remoteIP, true, durationSecond)
}
return fmt.Errorf("handleNoStreamCache:banned")
}