Mute some ActiveRecord::RecordNotUnique exceptions
This commit is contained in:
parent
05ec235ea3
commit
915dee3c4b
1 changed files with 11 additions and 1 deletions
|
|
@ -13,12 +13,22 @@ module Workers
|
|||
yield
|
||||
rescue Diaspora::ContactRequiredUnlessRequest,
|
||||
Diaspora::RelayableObjectWithoutParent,
|
||||
# Friendica seems to provoke these
|
||||
# Friendica seems to provoke these
|
||||
Diaspora::AuthorXMLAuthorMismatch => e
|
||||
Rails.logger.info("error on receive: #{e.class}")
|
||||
rescue ActiveRecord::RecordInvalid => e
|
||||
Rails.logger.info("failed to save received object: #{e.record.errors.full_messages}")
|
||||
raise e unless e.message.match(/already been taken/)
|
||||
rescue ActiveRecord::RecordNotUnique => e
|
||||
Rails.logger.info("failed to save received object: #{e.record.errors.full_messages}")
|
||||
raise e unless %w(
|
||||
index_comments_on_guid
|
||||
index_likes_on_guid
|
||||
index_posts_on_guid
|
||||
"duplicate key in table 'comments'"
|
||||
"duplicate key in table 'likes'"
|
||||
"duplicate key in table 'posts'"
|
||||
).any? {|index| e.message.include? index }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Reference in a new issue