Made article attachment creation thread safe.
This commit is contained in:
parent
befab460a5
commit
ef9dbde59d
1 changed files with 17 additions and 12 deletions
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue