mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-27 09:36:19 -05:00
FIX: Featuring topics wasn't happy with concurrency.
This commit is contained in:
parent
26964a72ca
commit
2cc6efba8c
1 changed files with 5 additions and 1 deletions
|
@ -40,7 +40,11 @@ class CategoryFeaturedTopic < ActiveRecord::Base
|
|||
CategoryFeaturedTopic.delete_all(category_id: c.id)
|
||||
if results
|
||||
results.each_with_index do |topic_id, idx|
|
||||
c.category_featured_topics.create(topic_id: topic_id, rank: idx)
|
||||
begin
|
||||
c.category_featured_topics.create(topic_id: topic_id, rank: idx)
|
||||
rescue PG::UniqueViolation
|
||||
# If another process features this topic, just ignore it
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue