Fix raising validation if followable already exist(race condition) (#5826)
* Fix raising validation if followable already exist(race condition) * Change Rails Logger for DataDogStatsClient and remove 'begin' keyword in follow method Co-authored-by: Gonzalo Ricco <gonzalo.ricco@leniolabs.com>
This commit is contained in:
parent
28440d1fa1
commit
dd796aaef3
1 changed files with 3 additions and 1 deletions
|
|
@ -70,8 +70,10 @@ class FollowsController < ApplicationController
|
|||
def follow(followable, need_notification: false)
|
||||
user_follow = current_user.follow(followable)
|
||||
Notification.send_new_follower_notification(user_follow) if need_notification
|
||||
|
||||
"followed"
|
||||
rescue ActiveRecord::RecordInvalid
|
||||
DataDogStatsClient.increment("users.invalid_follow")
|
||||
"already followed"
|
||||
end
|
||||
|
||||
def unfollow(followable, need_notification: false)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue