Skip to content
GitLab
Explore
Projects
Groups
Snippets
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Register
Sign in
Toggle navigation
Menu
Open sidebar
Tiger Ton
mastodon
Commits
104fdaf4
Commit
104fdaf4
authored
2 years ago
by
Eugen Rochko
Browse files
Options
Download
Email Patches
Plain Diff
Fix concurrent unfollowing decrementing follower count more than once
parent
a3909514
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
app/services/unfollow_service.rb
+7
-1
app/services/unfollow_service.rb
with
7 additions
and
1 deletion
+7
-1
app/services/unfollow_service.rb
+
7
-
1
View file @
104fdaf4
...
...
@@ -13,7 +13,13 @@ class UnfollowService < BaseService
@target_account
=
target_account
@options
=
options
unfollow!
||
undo_follow_request!
RedisLock
.
acquire
(
redis:
Redis
.
current
,
key:
"relationship:
#{
[
source_account
.
id
,
target_account
.
id
].
sort
.
join
(
':'
)
}
"
,
autorelease:
90
.
seconds
)
do
|
lock
|
if
lock
.
acquired?
unfollow!
||
undo_follow_request!
else
raise
Mastodon
::
RaceConditionError
end
end
end
private
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Explore
Projects
Groups
Snippets