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-1.93.7 mod/core/set/abstract/lock.rb
card-1.93.6 mod/core/set/abstract/lock.rb
card-1.93.5 mod/core/set/abstract/lock.rb
card-1.93.4 mod/core/set/abstract/lock.rb
card-1.93.3 mod/core/set/abstract/lock.rb
card-1.93.2 mod/core/set/abstract/lock.rb
card-1.93.1 mod/core/set/abstract/lock.rb
card-1.93.0 mod/core/set/abstract/lock.rb
card-1.92.2 mod/core/set/abstract/lock.rb
card-1.92.1 mod/core/set/abstract/lock.rb
card-1.92 mod/core/set/abstract/lock.rb
card-1.91 mod/core/set/abstract/lock.rb
card-1.21.0 mod/core/set/abstract/lock.rb