0
0
Fork 0

Rename with_lock to with_redis_lock to avoid confusion with ActiveRecord's method (#24741)

This commit is contained in:
Matt Jankowski 2023-05-02 12:16:07 -04:00 committed by GitHub
parent a7df578f97
commit f1c1dd0118
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 19 additions and 26 deletions

View file

@ -47,7 +47,7 @@ class ActivityPub::Activity::Create < ActivityPub::Activity
def create_status
return reject_payload! if unsupported_object_type? || non_matching_uri_hosts?(@account.uri, object_uri) || tombstone_exists? || !related_to_local_activity?
with_lock("create:#{object_uri}") do
with_redis_lock("create:#{object_uri}") do
return if delete_arrived_first?(object_uri) || poll_vote?
@status = find_existing_status
@ -313,7 +313,7 @@ class ActivityPub::Activity::Create < ActivityPub::Activity
poll = replied_to_status.preloadable_poll
already_voted = true
with_lock("vote:#{replied_to_status.poll_id}:#{@account.id}") do
with_redis_lock("vote:#{replied_to_status.poll_id}:#{@account.id}") do
already_voted = poll.votes.where(account: @account).exists?
poll.votes.create!(account: @account, choice: poll.options.index(@object['name']), uri: object_uri)
end