diff options
author | Eugen Rochko <eugen@zeonfederated.com> | 2022-05-13 00:02:35 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-13 00:02:35 +0200 |
commit | 6cf57c676550068a59149ca82d63fcb5b5431158 (patch) | |
tree | 4832da7de8828519c72a205d9878ccd5a606377a /app/lib/activitypub/activity/create.rb | |
parent | 12535568f7435ed627c37312782f8ca07e83eca9 (diff) |
Refactor how Redis locks are created (#18400)
* Refactor how Redis locks are created * Fix autorelease duration on account deletion lock
Diffstat (limited to 'app/lib/activitypub/activity/create.rb')
-rw-r--r-- | app/lib/activitypub/activity/create.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/app/lib/activitypub/activity/create.rb b/app/lib/activitypub/activity/create.rb index 1f32d8cce..73882e134 100644 --- a/app/lib/activitypub/activity/create.rb +++ b/app/lib/activitypub/activity/create.rb @@ -47,7 +47,7 @@ class ActivityPub::Activity::Create < ActivityPub::Activity def create_status return reject_payload! if unsupported_object_type? || invalid_origin?(object_uri) || tombstone_exists? || !related_to_local_activity? - lock_or_fail("create:#{object_uri}") do + with_lock("create:#{object_uri}") do return if delete_arrived_first?(object_uri) || poll_vote? @status = find_existing_status @@ -315,7 +315,7 @@ class ActivityPub::Activity::Create < ActivityPub::Activity poll = replied_to_status.preloadable_poll already_voted = true - lock_or_fail("vote:#{replied_to_status.poll_id}:#{@account.id}") do + with_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 |