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
|
@ -24,7 +24,7 @@ class ActivityPub::ProcessAccountService < BaseService
|
|||
# The key does not need to be unguessable, it just needs to be somewhat unique
|
||||
@options[:request_id] ||= "#{Time.now.utc.to_i}-#{username}@#{domain}"
|
||||
|
||||
with_lock("process_account:#{@uri}") do
|
||||
with_redis_lock("process_account:#{@uri}") do
|
||||
@account = Account.remote.find_by(uri: @uri) if @options[:only_key]
|
||||
@account ||= Account.find_remote(@username, @domain)
|
||||
@old_public_key = @account&.public_key
|
||||
|
|
|
@ -35,7 +35,7 @@ class ActivityPub::ProcessStatusUpdateService < BaseService
|
|||
last_edit_date = @status.edited_at.presence || @status.created_at
|
||||
|
||||
# Only allow processing one create/update per status at a time
|
||||
with_lock("create:#{@uri}") do
|
||||
with_redis_lock("create:#{@uri}") do
|
||||
Status.transaction do
|
||||
record_previous_edit!
|
||||
update_media_attachments!
|
||||
|
@ -58,7 +58,7 @@ class ActivityPub::ProcessStatusUpdateService < BaseService
|
|||
end
|
||||
|
||||
def handle_implicit_update!
|
||||
with_lock("create:#{@uri}") do
|
||||
with_redis_lock("create:#{@uri}") do
|
||||
update_poll!(allow_significant_changes: false)
|
||||
queue_poll_notifications!
|
||||
end
|
||||
|
|
|
@ -23,7 +23,7 @@ class FetchLinkCardService < BaseService
|
|||
|
||||
@url = @original_url.to_s
|
||||
|
||||
with_lock("fetch:#{@original_url}") do
|
||||
with_redis_lock("fetch:#{@original_url}") do
|
||||
@card = PreviewCard.find_by(url: @url)
|
||||
process_url if @card.nil? || @card.updated_at <= 2.weeks.ago || @card.missing_image?
|
||||
end
|
||||
|
|
|
@ -18,7 +18,7 @@ class RemoveStatusService < BaseService
|
|||
@account = status.account
|
||||
@options = options
|
||||
|
||||
with_lock("distribute:#{@status.id}") do
|
||||
with_redis_lock("distribute:#{@status.id}") do
|
||||
@status.discard_with_reblogs
|
||||
|
||||
StatusPin.find_by(status: @status)&.destroy
|
||||
|
|
|
@ -106,7 +106,7 @@ class ResolveAccountService < BaseService
|
|||
def fetch_account!
|
||||
return unless activitypub_ready?
|
||||
|
||||
with_lock("resolve:#{@username}@#{@domain}") do
|
||||
with_redis_lock("resolve:#{@username}@#{@domain}") do
|
||||
@account = ActivityPub::FetchRemoteAccountService.new.call(actor_url, suppress_errors: @options[:suppress_errors])
|
||||
end
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ class UnfollowService < BaseService
|
|||
@target_account = target_account
|
||||
@options = options
|
||||
|
||||
with_lock("relationship:#{[source_account.id, target_account.id].sort.join(':')}") do
|
||||
with_redis_lock("relationship:#{[source_account.id, target_account.id].sort.join(':')}") do
|
||||
unfollow! || undo_follow_request!
|
||||
end
|
||||
end
|
||||
|
|
|
@ -18,7 +18,7 @@ class VoteService < BaseService
|
|||
|
||||
already_voted = true
|
||||
|
||||
with_lock("vote:#{@poll.id}:#{@account.id}") do
|
||||
with_redis_lock("vote:#{@poll.id}:#{@account.id}") do
|
||||
already_voted = @poll.votes.where(account: @account).exists?
|
||||
|
||||
ApplicationRecord.transaction do
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue