Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions devcycle_python_sdk/managers/event_queue_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ def _flush_events(self) -> int:
return 0

with self._flush_lock:
payloads = []
try:
payloads = self._local_bucketing.flush_event_queue()
except Exception as e:
Expand Down
18 changes: 18 additions & 0 deletions test/managers/test_event_queue_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,24 @@ def test_publish_event_payload_non_retryable_api_error(self, mock_publish_events
)
self.test_local_bucketing.on_event_payload_success.assert_not_called()

@patch("devcycle_python_sdk.api.event_client.EventAPIClient.publish_events")
def test_flush_events_wasm_error_does_not_raise(self, mock_publish_events):
self.test_local_bucketing.flush_event_queue.side_effect = Exception(
"WASMAbortError: Request Payload has not finished sending"
)

manager = EventQueueManager(
self.sdk_key,
self.client_uuid,
self.test_options_no_thread,
self.test_local_bucketing,
)
# Must not raise UnboundLocalError; must return 0
result = manager._flush_events()

self.assertEqual(result, 0)
mock_publish_events.assert_not_called()

@patch("devcycle_python_sdk.api.event_client.EventAPIClient.publish_events")
def test_flush_events_no_events(self, mock_publish_events):
self.test_local_bucketing.flush_event_queue = MagicMock()
Expand Down
Loading