Sha256: 1db568ced29dbbf0642334e2d015efa0ae5ff6d97a1e7f013d923bed80dde6c7

Contents?: true

Size: 371 Bytes

Versions: 53

Compression:

Stored size: 371 Bytes

Contents

def lock
  was_already_locked = locked?
  return if was_already_locked
  Auth.as_bot do
    lock!
    yield
  end
ensure
  unlock! unless was_already_locked
end

def lock_cache_key
  "UPDATE-LOCK:#{key}"
end

def locked?
  Card.cache.read lock_cache_key
end

def lock!
  Card.cache.write lock_cache_key, true
end

def unlock!
  Card.cache.write lock_cache_key, false
end

Version data entries

53 entries across 53 versions & 2 rubygems

Version Path
card-mod-content-0.11.4 set/abstract/lock.rb
card-mod-content-0.11.3 set/abstract/lock.rb
card-mod-content-0.11.2 set/abstract/lock.rb
card-mod-content-0.11.1 set/abstract/lock.rb
card-mod-content-0.11.0 set/abstract/lock.rb
card-1.100.0 mod/core/set/abstract/lock.rb
card-1.99.6 mod/core/set/abstract/lock.rb
card-1.99.5 mod/core/set/abstract/lock.rb
card-1.99.4 mod/core/set/abstract/lock.rb
card-1.99.3 mod/core/set/abstract/lock.rb
card-1.99.2 mod/core/set/abstract/lock.rb
card-1.99.1 mod/core/set/abstract/lock.rb
card-1.99.0 mod/core/set/abstract/lock.rb
card-1.98.3 mod/core/set/abstract/lock.rb
card-1.98.2 mod/core/set/abstract/lock.rb
card-1.98.1 mod/core/set/abstract/lock.rb
card-1.98.0 mod/core/set/abstract/lock.rb
card-1.97.0.1 mod/core/set/abstract/lock.rb
card-1.97.0 mod/core/set/abstract/lock.rb
card-1.96.8 mod/core/set/abstract/lock.rb