Set self.last_sent_time on first call to flush
This fixes that on first call to batch() 1-size batch is sent
@@ -423,6 +423,9 @@ def flush(self, force=False):
if self.queue_size() == 0:
return
+ if not self.last_sent_time:
+ self.last_sent_time = time()
+
elapsed = time() - self.last_sent_time
if elapsed >= self.batch_delay or force is True:
self.submit()
