lib/sqs_buffer/client.rb in sqs_buffer-0.2.3 vs lib/sqs_buffer/client.rb in sqs_buffer-0.2.4
- old
+ new
@@ -88,11 +88,11 @@
def process_all_messages
@process_block.value.call(buffer)
delete_all_messages
touch_process_time
rescue StandardError => e
- @logger.error "An exception(#{e.message}) occurred while process the message queue: #{@message_queue.join("\n")} | Backtrace: #{e.backtrace}"
+ @logger.error "An exception(#{e.message}) occurred while processing the message queue: #{@message_queue.join("\n")} | Backtrace: #{e.backtrace}"
end
def process_block(&block)
@process_block.value = block
end
@@ -148,11 +148,15 @@
@last_process_time.value = Time.now.to_i
end
def delete_all_messages
while @message_queue.length > 0 do
- messages = @message_queue.shift(10)
- @poller.delete_messages(messages)
+ begin
+ messages = @message_queue.shift(10)
+ @poller.delete_messages(messages)
+ rescue StandardError => e
+ @logger.error "An exception(#{e.message}) occurred while deleting these messages: #{messages.join("\n")} | Backtrace: #{e.backtrace}"
+ end
end
end
end
end