Browse Source

Fix concurrent unfollowing decrementing follower count more than once (#18527)

closed-social-glitch-2
Eugen Rochko 2 years ago
committed by GitHub
parent
commit
52f4e834f2
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 1 deletions
  1. +5
    -1
      app/services/unfollow_service.rb

+ 5
- 1
app/services/unfollow_service.rb View File

@ -2,6 +2,8 @@
class UnfollowService < BaseService
include Payloadable
include Redisable
include Lockable
# Unfollow and notify the remote user
# @param [Account] source_account Where to unfollow from
@ -13,7 +15,9 @@ class UnfollowService < BaseService
@target_account = target_account
@options = options
unfollow! || undo_follow_request!
with_lock("relationship:#{[source_account.id, target_account.id].sort.join(':')}") do
unfollow! || undo_follow_request!
end
end
private

Loading…
Cancel
Save