Made article creation thread safe.

This commit is contained in:
Thorsten Eckel 2015-07-24 12:17:42 +02:00
parent 72d830c408
commit 738069dfba

View file

@ -652,9 +652,14 @@ module Import::OTRS
article_object.update_attributes(article_new)
else
log "add Ticket::Article.find(#{article_new[:id]})"
article_object = Ticket::Article.new(article_new)
article_object.id = article_new[:id]
article_object.save
begin
article_object = Ticket::Article.new(article_new)
article_object.id = article_new[:id]
article_object.save
rescue ActiveRecord::RecordNotUnique
log "Ticket #{ticket_new[:id]} (article #{article_new[:id]}) is handled by another thead, skipping."
next
end
end
next if !article['Attachments']