Sha256: e0508a5e749e761492b19e92571ad48fcbb44b37a2655c924e76fbdda42dd525
Contents?: true
Size: 785 Bytes
Versions: 2
Compression:
Stored size: 785 Bytes
Contents
require 'sc-lock' module AplLocker extend ScLock # Resources module RES INVOICE = "Invoice" PAYMENT = "Payment" APPLICATION = "Application" end # Namespaces module NS I2P = "I2P" I2I = "I2I" end # hold lock only for the 'block' and delete from database once done. def self.locked_block namespace, resource, params, wait_time=1000.0, retry_count=0, &block error = nil begin lock(namespace, resource, params, nil, 600, wait_time, retry_count, &block) rescue Exception => e error = e # delete lock and raise it again resource_lock = ScLock::Lock.find_by_resource_name_and_key("#{namespace}-#{resource}", params.sort.to_s) resource_lock.delete if resource_lock end raise error if error end end
Version data entries
2 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
apl-library-0.0.90 | lib/apl-library/apl_locker.rb |
apl-library-0.0.90 | vendor/bundle/ruby/2.1.0/gems/apl-library-0.0.90/lib/apl-library/apl_locker.rb |