Skip to content

Commit

Permalink
Fixes #38169 - Fix operatingsystem race condition with concurrent reg…
Browse files Browse the repository at this point in the history
…istrations
  • Loading branch information
jeremylenz committed Jan 31, 2025
1 parent 74ddd88 commit 6c6953a
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion app/services/katello/rhsm_fact_parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,13 @@ def operatingsystem
os_attributes[:name] = "CentOS"
end

::Operatingsystem.find_or_create_by(os_attributes)
os = ::Operatingsystem.find_by(os_attributes)
if os.blank?
created = ::Operatingsystem.create_or_find_by(os_attributes)
created.errors.any? ? ::Operatingsystem.find_by(os_attributes) : created
else
os
end
end
end

Expand Down

0 comments on commit 6c6953a

Please sign in to comment.