超时时间改为10分钟

This commit is contained in:
Yun
2023-11-27 21:59:07 +08:00
parent 7640fa7111
commit 302914eb94
+2 -2
View File
@@ -19,7 +19,7 @@ type globalLock struct {
}
func NewGlobalLock(ctx context.Context, red *redis.Client, uniqueKey string) *globalLock {
ctx, cancel := context.WithTimeout(ctx, time.Second*30)
ctx, cancel := context.WithTimeout(ctx, time.Minute*10)
return &globalLock{
redis: red,
ctx: ctx,
@@ -82,7 +82,7 @@ func (g *globalLock) Unlock() bool {
log.Println("globalLock Unlock", resp, err, g.uniqueKey, g.value)
}
g.cancel()
return false
return true
}
// 刷新锁