lib/logstash/outputs/redis.rb in logstash-output-redis-1.0.0 vs lib/logstash/outputs/redis.rb in logstash-output-redis-2.0.0

- old
+ new

@@ -190,15 +190,15 @@ @congestion_check_times[key] = Time.now.to_i end end # called from Stud::Buffer#buffer_flush when there are events to flush - def flush(events, key, teardown=false) + def flush(events, key, close=false) @redis ||= connect - # we should not block due to congestion on teardown + # we should not block due to congestion on close # to support this Stud::Buffer#buffer_flush should pass here the :final boolean value. - congestion_check(key) unless teardown + congestion_check(key) unless close @redis.rpush(key, events) end # called from Stud::Buffer#buffer_flush when an error occurs def on_flush_error(e) @logger.warn("Failed to send backlog of events to Redis", @@ -207,10 +207,10 @@ :backtrace => e.backtrace ) @redis = connect end - def teardown + def close if @batch buffer_flush(:final => true) end if @data_type == 'channel' and @redis @redis.quit