-
-
Notifications
You must be signed in to change notification settings - Fork 6.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor how Redis locks are created #18400
Conversation
RedisLock.acquire(lock_options) do |lock| | ||
if lock.acquired? | ||
already_voted = @poll.votes.where(account: @account).exists? | ||
with_lock("vote:#{@poll.id}:#{@account.id}") do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This changes the autorelease duration, but maybe it's not a bad thing.
else | ||
raise Mastodon::RaceConditionError | ||
end | ||
with_lock("distribute:#{status_id}") do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This changes the autorelease duration (from 5 minutes to 15 minutes), but not sure this matters.
@@ -12,22 +12,22 @@ def perform | |||
private | |||
|
|||
def delete_person | |||
lock_or_return("delete_in_progress:#{@account.id}") do | |||
with_lock("delete_in_progress:#{@account.id}", raise_on_failure: false) do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This changes the autorelease from 2 hours to 15 minutes. DeleteAccountService
can potentially take a really long time to return, so 15 minutes might be too short of a duration in certain cases.
* Refactor how Redis locks are created * Fix autorelease duration on account deletion lock
* Refactor how Redis locks are created * Fix autorelease duration on account deletion lock
No description provided.