From f60c78b7e2237ee0d31e4d874d6dc0fb0c190c1d Mon Sep 17 00:00:00 2001 From: kavehjamshidi Date: Thu, 10 Aug 2023 22:59:16 +0330 Subject: [PATCH] use exported error redis.Nil --- slidingwindow.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/slidingwindow.go b/slidingwindow.go index 28a391d..58b9d1d 100644 --- a/slidingwindow.go +++ b/slidingwindow.go @@ -136,7 +136,7 @@ func (s *SlidingWindowRedis) Increment(ctx context.Context, prev, curr time.Time case <-done: if err == redis.TxFailedErr { return 0, 0, errors.Wrap(err, "redis transaction failed") - } else if err != nil && err.Error() == "redis: nil" { // TODO: is there an exported error of that type? + } else if err != nil && err.Error() == redis.Nil { prevCount = 0 } else if err != nil { return 0, 0, errors.Wrap(err, "unexpected error from redis")