feat: add lock

Browse Source
main
git 2024-05-25 00:32:35 +08:00
parent 074d740817
commit 994478a00f
Signed by: git
GPG Key ID: 3F65EFFA44207ADD
1 changed files with 1 additions and 0 deletions

View File

@ -74,6 +74,7 @@ func (r etcdLock) Lock(key string, unixTsToExpireNs int64) error {
ctx, cancel := context.WithTimeout(context.Background(), time.Second*2) ctx, cancel := context.WithTimeout(context.Background(), time.Second*2)
defer cancel() defer cancel()
if err := m.Lock(ctx); err != nil { if err := m.Lock(ctx); err != nil {
_ = s.Close() _ = s.Close()
return err return err