Made article attachment creation thread safe.

This commit is contained in:
Thorsten Eckel 2015-07-24 12:10:36 +02:00
parent befab460a5
commit ef9dbde59d

View file

@ -668,6 +668,7 @@ module Import::OTRS
# import article attachments # import article attachments
article['Attachments'].each { |attachment| article['Attachments'].each { |attachment|
begin
Store.add( Store.add(
object: 'Ticket::Article', object: 'Ticket::Article',
o_id: article_object.id, o_id: article_object.id,
@ -680,6 +681,10 @@ module Import::OTRS
}, },
created_by_id: 1, created_by_id: 1,
) )
rescue ActiveRecord::RecordNotUnique
log "Ticket #{ticket_new[:id]} (article #{article_object.id}, Content-ID #{attachment['ContentID']}) is handled by another thead, skipping."
next
end
} }
end end
end end