@@ -265,7 +265,7 @@ def test_odp_event_manager_retry_failure(self, *args):
265265
266266 with mock .patch .object (
267267 event_manager .api_manager , 'send_odp_events' , new_callable = CopyingMock , return_value = True
268- ) as mock_send , mock . patch ( 'time.sleep' ) as mock_sleep :
268+ ) as mock_send :
269269 event_manager .send_event (** self .events [0 ])
270270 event_manager .send_event (** self .events [1 ])
271271 event_manager .flush ()
@@ -275,9 +275,7 @@ def test_odp_event_manager_retry_failure(self, *args):
275275 [mock .call (self .api_key , self .api_host , self .processed_events )] * number_of_tries
276276 )
277277 self .assertEqual (len (event_manager ._current_batch ), 0 )
278- # Verify exponential backoff delays: 0.2s, 0.4s, 0.8s
279- mock_sleep .assert_has_calls ([mock .call (0.2 ), mock .call (0.4 ), mock .call (0.8 )])
280- mock_logger .debug .assert_any_call ('Error dispatching ODP events, retrying after 0.2s.' )
278+ mock_logger .debug .assert_any_call ('Error dispatching ODP events, scheduled to retry.' )
281279 mock_logger .error .assert_called_once_with (
282280 f'ODP event send failed (Failed after 3 retries: { self .processed_events } ).'
283281 )
@@ -290,17 +288,15 @@ def test_odp_event_manager_retry_success(self, *args):
290288
291289 with mock .patch .object (
292290 event_manager .api_manager , 'send_odp_events' , new_callable = CopyingMock , side_effect = [True , True , False ]
293- ) as mock_send , mock . patch ( 'time.sleep' ) as mock_sleep :
291+ ) as mock_send :
294292 event_manager .send_event (** self .events [0 ])
295293 event_manager .send_event (** self .events [1 ])
296294 event_manager .flush ()
297295 event_manager .event_queue .join ()
298296
299297 mock_send .assert_has_calls ([mock .call (self .api_key , self .api_host , self .processed_events )] * 3 )
300298 self .assertEqual (len (event_manager ._current_batch ), 0 )
301- # Verify exponential backoff delays: 0.2s, 0.4s (only 2 delays for 3 attempts)
302- mock_sleep .assert_has_calls ([mock .call (0.2 ), mock .call (0.4 )])
303- mock_logger .debug .assert_any_call ('Error dispatching ODP events, retrying after 0.2s.' )
299+ mock_logger .debug .assert_any_call ('Error dispatching ODP events, scheduled to retry.' )
304300 mock_logger .error .assert_not_called ()
305301 self .assertStrictTrue (event_manager .is_running )
306302 event_manager .stop ()
0 commit comments