Skip to content

Commit

Permalink
Fix an issue where negative lock sequence numbers are incorrectly mad…
Browse files Browse the repository at this point in the history
…e positive.
  • Loading branch information
colinmcintosh committed Sep 1, 2021
1 parent d0ed5a2 commit 2f4106e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions gateway/locking/zookeeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ func (l *ZookeeperNonBlockingLock) ID() string {
}

func parseSeq(path string) (int, error) {
parts := strings.Split(path, "-")
parts := strings.Split(path, ":")
return strconv.Atoi(parts[len(parts)-1])
}

Expand All @@ -127,7 +127,7 @@ func (l *ZookeeperNonBlockingLock) try() (bool, error) {
return true, zk.ErrDeadlock
}

prefix := fmt.Sprintf("%s/lock-", l.id)
prefix := fmt.Sprintf("%s/lock:", l.id)

// Attempt to add a sequence to the tree
path, err := l.conn.CreateProtectedEphemeralSequential(prefix, []byte(l.member), l.acl)
Expand Down

0 comments on commit 2f4106e

Please sign in to comment.