chore: fix warnings (#3989)

This commit is contained in:
Kevin Wan
2024-03-08 22:35:17 +08:00
committed by GitHub
parent 69bb746a1d
commit 159ecb7386
32 changed files with 64 additions and 61 deletions

View File

@@ -8,7 +8,7 @@ const (
)
type (
// An Options is used to store the cache options.
// Options is used to store the cache options.
Options struct {
Expiry time.Duration
NotFoundExpiry time.Duration

View File

@@ -47,7 +47,7 @@ func (rc RedisConf) NewRedis() *Redis {
opts = append(opts, WithTLS())
}
return New(rc.Host, opts...)
return newRedis(rc.Host, opts...)
}
// Validate validates the RedisConf.

View File

@@ -2,6 +2,7 @@ package redis
import (
"context"
"errors"
"math/rand"
"strconv"
"sync/atomic"
@@ -64,7 +65,7 @@ func (rl *RedisLock) AcquireCtx(ctx context.Context) (bool, error) {
resp, err := rl.store.ScriptRunCtx(ctx, lockScript, []string{rl.key}, []string{
rl.id, strconv.Itoa(int(seconds)*millisPerSecond + tolerance),
})
if err == red.Nil {
if errors.Is(err, red.Nil) {
return false, nil
} else if err != nil {
logx.Errorf("Error on acquiring lock for %s, %s", rl.key, err.Error())