lib/logstash/inputs/mongoprofile.rb in logstash-input-mongoprofile-0.1.6 vs lib/logstash/inputs/mongoprofile.rb in logstash-input-mongoprofile-0.1.7

- old
+ new

@@ -98,11 +98,15 @@ yield @parser.parse(document) end end def get_last_document_date - @documents[-1]['ts'] + if @documents != nil + @documents[-1]['ts'] + else + nil + end end private def generate_id # noinspection RubyArgCount @@ -165,10 +169,14 @@ documents = @mongo_accessor.get_documents_by_ts(last_date_value, @limit) end profile_collection = ProfileCollection.new(documents, @document_parser) - @last_value_store.save_last_value(profile_collection.get_last_document_date) + if profile_collection.get_last_document_date != nil + @last_value_store.save_last_value(profile_collection.get_last_document_date) + end + @logger.info('Nothing to get...') + else profile_collection end end \ No newline at end of file