diff --git a/event_routing_backends/backends/events_router.py b/event_routing_backends/backends/events_router.py index 93511adf..42c3dd7e 100644 --- a/event_routing_backends/backends/events_router.py +++ b/event_routing_backends/backends/events_router.py @@ -155,8 +155,13 @@ def bulk_send(self, events): for events_for_route in event_routes.values(): prepared_events = [] host = None + ids = set() for _, updated_event, host, _ in events_for_route: + if updated_event["id"] in set(): + logger.info(f"Found duplicated event {updated_event['id']}") + continue prepared_events.append(updated_event) + ids.add(updated_event["id"]) if prepared_events: # pragma: no cover self.dispatch_bulk_events( diff --git a/event_routing_backends/utils/xapi_lrs_client.py b/event_routing_backends/utils/xapi_lrs_client.py index 1bb61745..4e9f1216 100644 --- a/event_routing_backends/utils/xapi_lrs_client.py +++ b/event_routing_backends/utils/xapi_lrs_client.py @@ -75,7 +75,7 @@ def bulk_send(self, statement_data): response = self.lrs_client.save_statements(statement_data) if not response.success: - if response.response.code == 409 or response.response.code == 204: + if response.response.code == 409: logger.warning(f"Duplicate event id found in: {response.request.content}") else: logger.warning(f"Failed request: {response.request.content}")