From fb96de3b0293d892cad6ec2b7932dcb061303cc4 Mon Sep 17 00:00:00 2001 From: joamag Date: Wed, 16 Jan 2019 18:55:05 +0000 Subject: [PATCH] New force flag --- src/logstash/base.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/logstash/base.py b/src/logstash/base.py index 6c6b372..78e433c 100644 --- a/src/logstash/base.py +++ b/src/logstash/base.py @@ -89,8 +89,8 @@ def log_buffer(self, payload): time.time() > self._last_flush + self.timeout if should_flush: self._flush_buffer() - def log_flush(self): - self._flush_buffer() + def log_flush(self, force = True): + self._flush_buffer(force = force) def _flush_buffer(self, force = False): # retrieves some references from the current instance that @@ -110,7 +110,7 @@ def _flush_buffer(self, force = False): # schedules the call log operation and then empties the buffer # so that it's no longer going to be used (flushed), notice that # in case there's no delayer available calls the method immediately - if self.delayer: self.delayer(call_log) + if self.delayer and not force: self.delayer(call_log) else: call_log() self._buffer = [] self._last_flush = time.time()