asset tracker duplicate entry fixes
@@ -112,8 +112,8 @@ class Ingest(object):
_max_readings_insert_batch_reconnect_wait_seconds = 10
"""The maximum number of seconds to wait before reconnecting to storage when inserting readings"""
- _last_event_payload = dict()
- """The last event payload for asset tracker"""
+ _payload_events = []
+ """The list of unique reading payload for asset tracker"""
# Configuration (end)
@@ -194,7 +194,7 @@ class Ingest(object):
cls._max_readings_insert_batch_reconnect_wait_seconds = int(
config['max_readings_insert_batch_reconnect_wait_seconds']['value'])
- cls._last_event_payload = dict()
+ cls._payload_events = []
@classmethod
async def start(cls, parent):
@@ -571,10 +571,9 @@ class Ingest(object):
# asset tracker checking
payload = {"asset": asset, "event": "Ingest", "service": cls._parent_service._name,
"plugin": cls._parent_service._plugin_handle['plugin']['value']}
-
- if payload != cls._last_event_payload:
+ if payload not in cls._payload_events:
cls._parent_service._core_microservice_management_client.create_asset_tracker_event(payload)
- cls._last_event_payload = payload
+ cls._payload_events.append(payload)
# _LOGGER.debug('Add readings list index: %s size: %s', cls._current_readings_list_index, list_size)
