Commit ae18cea1 authored by Matthew Slipper's avatar Matthew Slipper

proxyd: Don't hit Redis when the out of service interval is zero

When the out of service interval is zero, `proxyd` will send a `SETEX` command to Redis with a zero expiry. This is technically an error, and causes messages like `error setting backend unavailable ERR invalid expire time in setex` to appear in the logs. Users won't notice the issue since `proxyd` can continue working when Redis returns an error, but we should clean this up nonetheless since these problems appear in our alerting.
parent 779709f2
---
'@eth-optimism/proxyd': patch
---
Don't hit Redis when the out of service interval is zero
......@@ -85,6 +85,9 @@ func (r *RedisRateLimiter) IsBackendOnline(name string) (bool, error) {
}
func (r *RedisRateLimiter) SetBackendOffline(name string, duration time.Duration) error {
if duration == 0 {
return nil
}
err := r.rdb.SetEX(
context.Background(),
fmt.Sprintf("backend:%s:offline", name),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment