@@ -181,10 +181,10 @@ def _run(self):
181
181
try :
182
182
while True :
183
183
if self ._get_time () >= self .flushing_interval_deadline :
184
- self ._flush_queue ()
184
+ self ._flush_batch ()
185
185
self .flushing_interval_deadline = self ._get_time () + \
186
186
self ._get_time (self .flush_interval .total_seconds ())
187
- self .logger .debug ('Flush interval deadline. Flushed queue .' )
187
+ self .logger .debug ('Flush interval deadline. Flushed batch .' )
188
188
189
189
try :
190
190
interval = self .flushing_interval_deadline - self ._get_time ()
@@ -202,7 +202,7 @@ def _run(self):
202
202
203
203
if item == self ._FLUSH_SIGNAL :
204
204
self .logger .debug ('Received flush signal.' )
205
- self ._flush_queue ()
205
+ self ._flush_batch ()
206
206
continue
207
207
208
208
if isinstance (item , UserEvent ):
@@ -213,14 +213,14 @@ def _run(self):
213
213
214
214
finally :
215
215
self .logger .info ('Exiting processing loop. Attempting to flush pending events.' )
216
- self ._flush_queue ()
216
+ self ._flush_batch ()
217
217
218
218
def flush (self ):
219
219
""" Adds flush signal to event_queue. """
220
220
221
221
self .event_queue .put (self ._FLUSH_SIGNAL )
222
222
223
- def _flush_queue (self ):
223
+ def _flush_batch (self ):
224
224
""" Flushes event_queue by dispatching events. """
225
225
batch_len = len (self ._current_batch )
226
226
if batch_len == 0 :
@@ -270,9 +270,8 @@ def _add_to_batch(self, user_event):
270
270
user_event: UserEvent Instance.
271
271
"""
272
272
if self ._should_split (user_event ):
273
- self .logger .debug ('Flush on split.' )
274
- self ._flush_queue ()
275
- self ._current_batch = list ()
273
+ self .logger .debug ('Flushing batch on split.' )
274
+ self ._flush_batch ()
276
275
277
276
# Reset the deadline if starting a new batch.
278
277
if len (self ._current_batch ) == 0 :
@@ -282,7 +281,7 @@ def _add_to_batch(self, user_event):
282
281
self ._current_batch .append (user_event )
283
282
if len (self ._current_batch ) >= self .batch_size :
284
283
self .logger .debug ('Flushing on batch size.' )
285
- self ._flush_queue ()
284
+ self ._flush_batch ()
286
285
287
286
def _should_split (self , user_event ):
288
287
""" Method to check if current event batch should split into two.
0 commit comments