From b62938827391b576e7bf361a381827f92efe3705 Mon Sep 17 00:00:00 2001 From: quexer Date: Thu, 26 Oct 2023 11:21:17 +0800 Subject: [PATCH] fix: ttl bug in case re-lock --- v4/sync/memory/memory.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/v4/sync/memory/memory.go b/v4/sync/memory/memory.go index 180c3804..37585c94 100644 --- a/v4/sync/memory/memory.go +++ b/v4/sync/memory/memory.go @@ -118,7 +118,7 @@ func (m *memorySync) Lock(id string, opts ...sync.LockOption) error { // release the lock if it expired _ = m.Unlock(id) } else { - ttl = time.After(live) + ttl = time.After(lk.ttl - live) } }