Skip to content

Commit

Permalink
Define a DLocker interface for distributed locker
Browse files Browse the repository at this point in the history
Signed-off-by: Benjamin Wang <benjamin.ahrtr@gmail.com>
  • Loading branch information
ahrtr committed Oct 24, 2024
1 parent 2f36df8 commit 7b82523
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions contrib/lock/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,12 @@ func main() {
locker := concurrency.NewLocker(session, "/lock")
locker.Lock()
defer locker.Unlock()
version := session.Lease()
leaseID := session.Lease()
version := locker.Rev()
log.Printf("acquired lock, version: %x", version)

if mode == 1 {
log.Printf("please manually revoke the lease using 'etcdctl lease revoke %x' or wait for it to expire, then start executing client 2 and hit any key...", version)
log.Printf("please manually revoke the lease using 'etcdctl lease revoke %x' or wait for it to expire, then start executing client 2 and hit any key...", leaseID)
reader := bufio.NewReader(os.Stdin)
_, _ = reader.ReadByte()
log.Print("resuming client 1")
Expand Down

0 comments on commit 7b82523

Please sign in to comment.