mirror of
https://github.com/maxlerebourg/crowdsec-bouncer-traefik-plugin.git
synced 2026-09-02 20:28:50 +02:00
Adjust lease duration to prevent cache update conflicts
Updated lease duration logic to ensure a minimum of 1 second.
This commit is contained in:
+1
-2
@@ -641,8 +641,7 @@ func handleStreamCache(bouncer *Bouncer) error {
|
||||
if err.Error() != cache.CacheMiss {
|
||||
return err
|
||||
}
|
||||
// The lease expires just before the next tick, but it also has to be stored at all:
|
||||
// the local cache ignores a zero duration and redis rejects a non positive EX.
|
||||
// To avoid every instance trying to update the cache, set 1 second at least
|
||||
leaseDuration := bouncer.updateInterval - 1
|
||||
if leaseDuration < 1 {
|
||||
leaseDuration = 1
|
||||
|
||||
Reference in New Issue
Block a user