diff --git a/ratelimits/source_redis.go b/ratelimits/source_redis.go index 83f7046280d..cba7aab9532 100644 --- a/ratelimits/source_redis.go +++ b/ratelimits/source_redis.go @@ -89,7 +89,9 @@ func (r *RedisSource) BatchSet(ctx context.Context, buckets map[string]time.Time pipeline := r.client.Pipeline() for bucketKey, tat := range buckets { - pipeline.Set(ctx, bucketKey, tat.UTC().UnixNano(), 0) + // Set a TTL of TAT + 10 minutes to account for clock skew. + ttl := tat.UTC().Sub(r.clk.Now()) + time.Minute*10 + pipeline.Set(ctx, bucketKey, tat.UTC().UnixNano(), ttl) } _, err := pipeline.Exec(ctx) if err != nil {