Rename with_lock
to with_redis_lock
to avoid confusion with ActiveRecord's method (#24741)
This commit is contained in:
parent
a7df578f97
commit
f1c1dd0118
16 changed files with 19 additions and 26 deletions
|
@ -5,7 +5,7 @@ module Lockable
|
|||
# @param [ActiveSupport::Duration] autorelease Automatically release the lock after this time
|
||||
# @param [Boolean] raise_on_failure Raise an error if a lock cannot be acquired, or fail silently
|
||||
# @raise [Mastodon::RaceConditionError]
|
||||
def with_lock(lock_name, autorelease: 15.minutes, raise_on_failure: true)
|
||||
def with_redis_lock(lock_name, autorelease: 15.minutes, raise_on_failure: true)
|
||||
with_redis do |redis|
|
||||
RedisLock.acquire(redis: redis, key: "lock:#{lock_name}", autorelease: autorelease.seconds) do |lock|
|
||||
if lock.acquired?
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue