lib/deimos/utils/db_producer.rb in deimos-ruby-1.22.4 vs lib/deimos/utils/db_producer.rb in deimos-ruby-1.22.5
- old
+ new
@@ -95,14 +95,19 @@
compacted_messages = compact_messages(messages)
log_messages(compacted_messages)
Deimos.instrument('db_producer.produce', topic: @current_topic, messages: compacted_messages) do
begin
produce_messages(compacted_messages.map(&:phobos_message))
- rescue Kafka::BufferOverflow, Kafka::MessageSizeTooLarge, Kafka::RecordListTooLarge
+ rescue Kafka::BufferOverflow, Kafka::MessageSizeTooLarge, Kafka::RecordListTooLarge => e
delete_messages(messages)
@logger.error('Message batch too large, deleting...')
- @logger.error(Deimos::KafkaMessage.decoded(messages))
- raise
+ begin
+ @logger.error(Deimos::KafkaMessage.decoded(messages))
+ rescue StandardError => logging_exception # rubocop:disable Naming/RescuedExceptionsVariableName
+ @logger.error("Large message details logging failure: #{logging_exception.message}")
+ ensure
+ raise e
+ end
end
end
delete_messages(messages)
Deimos.config.metrics&.increment(
'db_producer.process',