Skip to content

Commit

Permalink
fix: less cancel failure
Browse files Browse the repository at this point in the history
  • Loading branch information
songzhibin97 committed Apr 18, 2024
1 parent f2833db commit 1ed675c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion distributed/locker/lock_ridis/lease.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,11 @@ func LeaseLock(lock locker.Locker, key string, expire int, ops ...options.Option
}

return func() error {
if cls.Load() {
return nil
}
cls.Store(true)
cancel()
defer cancel()
return lock.UnLock(key, mark)
}, nil
}

0 comments on commit 1ed675c

Please sign in to comment.