优化锁的使用

This commit is contained in:
Yun
2024-12-12 11:30:24 +08:00
parent 571b852c1a
commit cd0273f4b2
4 changed files with 69 additions and 0 deletions
+2
View File
@@ -17,6 +17,8 @@ type globalLock struct {
value string
}
func NewGlobalLock(ctx context.Context, red redis.UniversalClient, uniqueKey string) *globalLock {
ctx, cancel := context.WithTimeout(ctx, opt.lockTimeout)
return &globalLock{