File tree Expand file tree Collapse file tree 2 files changed +8
-4
lines changed Expand file tree Collapse file tree 2 files changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -222,10 +222,13 @@ def flush(self):
222
222
223
223
def _flush_queue (self ):
224
224
""" Flushes event_queue by dispatching events. """
225
- self .logger .debug ('Flushing the queue.' )
226
- if len (self ._current_batch ) == 0 :
225
+ batch_len = len (self ._current_batch )
226
+ if batch_len == 0 :
227
+ self .logger .debug ('Nothing to flush.' )
227
228
return
228
229
230
+ self .logger .debug ('Flushing batch size ' + str (batch_len ))
231
+
229
232
with self .LOCK :
230
233
to_process_batch = list (self ._current_batch )
231
234
self ._current_batch = list ()
Original file line number Diff line number Diff line change @@ -179,7 +179,7 @@ def test_flush_once_max_timeout(self):
179
179
self .optimizely .logger = SimpleLogger (enums .LogLevels .DEBUG )
180
180
181
181
with mock .patch .object (self .optimizely , 'logger' ) as mock_config_logging :
182
- self ._set_event_processor (event_dispatcher , mock_config_logging )
182
+ self ._set_event_processor (event_dispatcher , self . optimizely . logger )
183
183
184
184
user_event = self ._build_conversion_event (self .event_name )
185
185
self .event_processor .process (user_event )
@@ -192,7 +192,8 @@ def test_flush_once_max_timeout(self):
192
192
self .assertTrue (mock_config_logging .debug .called )
193
193
mock_config_logging .debug .assert_any_call ('Received event of type ConversionEvent for user test_user.' )
194
194
mock_config_logging .debug .assert_any_call ('Flush interval deadline. Flushed queue.' )
195
- self .assertTrue (mock_config_logging .debug .call_count == 2 )
195
+ mock_config_logging .debug .assert_any_call ('Flushing batch size 1' )
196
+ self .assertTrue (mock_config_logging .debug .call_count == 3 )
196
197
self .optimizely .logger = SimpleLogger ()
197
198
198
199
def test_flush_max_batch_size (self ):
You can’t perform that action at this time.
0 commit comments