Skip to content

Commit

Permalink
fix unlock logic
Browse files Browse the repository at this point in the history
  • Loading branch information
terrywbrady committed May 14, 2024
1 parent b3a30a4 commit 182c672
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
10 changes: 10 additions & 0 deletions src/main/ruby/lib/merritt_zk_locks.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ def self.lock_large_access_queue(zk)

def self.unlock_large_access_queue(zk)
zk.delete(LOCKS_QUEUE_ACCESS_LARGE)
rescue StandardError
# no action
end

def self.lock_small_access_queue(zk)
Expand All @@ -67,6 +69,8 @@ def self.lock_small_access_queue(zk)

def self.unlock_small_access_queue(zk)
zk.delete(LOCKS_QUEUE_ACCESS_SMALL)
rescue StandardError
# no action
end

def self.lock_collection(zk, mnemonic)
Expand All @@ -75,6 +79,8 @@ def self.lock_collection(zk, mnemonic)

def self.unlock_collection(zk, mnemonic)
zk.delete("#{LOCKS_COLLECTION}/#{mnemonic}")
rescue StandardError
# no action
end

def self.lock_object_storage(zk, ark)
Expand All @@ -83,6 +89,8 @@ def self.lock_object_storage(zk, ark)

def self.unlock_object_storage(zk, ark)
zk.delete("#{LOCKS_STORAGE}/#{ark.gsub('/', '_')}")
rescue StandardError
# no action
end

def self.lock_object_inventory(zk, ark)
Expand All @@ -91,6 +99,8 @@ def self.lock_object_inventory(zk, ark)

def self.unlock_object_inventory(zk, ark)
zk.delete("#{LOCKS_INVENTORY}/#{ark.gsub('/', '_')}")
rescue StandardError
# no action
end
end
end
4 changes: 3 additions & 1 deletion src/main/ruby/show_all.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ def get_payload(p, d)
JSON.parse(d.bytes[9..].pack('c*'))
elsif %w[/accessLarge.1 /accessSmall.1 /mrt.inventory.full].include?(p)
d.bytes[9..].pack('c*')
elsif %w[/mrt.lock /mrt.InvLock].include?(p)
elsif %w[/mrt.InvLock].include?(p)
d.bytes[8..].pack('c*')
elsif p =~ %r[/mrt.lock/ark]
d.bytes[8..].pack('c*')
else
begin
Expand Down

0 comments on commit 182c672

Please sign in to comment.