Skip to content

Commit

Permalink
fix: Profile pictures missing in facebook inbox [CW-1976] (#9212)
Browse files Browse the repository at this point in the history
The ActiveJob FacebookEventsJob created a Contact and then enqueued Avatar::AvatarFromUrlJob in another process. However, since the Contact was created within a transaction when AvatarFromUrlJob was executed immediately afterwards, the Contact was not actually present in the database then.

Fixes: #6138 #6761
  • Loading branch information
imtoanle committed May 9, 2024
1 parent 3a12995 commit 4eec0aa
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/builders/contact_inbox_with_contact_builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ def find_or_create_contact_and_contact_inbox

ActiveRecord::Base.transaction(requires_new: true) do
build_contact_with_contact_inbox
update_contact_avatar(@contact) unless @contact.avatar.attached?
@contact_inbox
end
update_contact_avatar(@contact) unless @contact.avatar.attached?
@contact_inbox
end

private
Expand Down

0 comments on commit 4eec0aa

Please sign in to comment.