Skip to content

Commit

Permalink
SnapShooter: Bugfix - occasional duplicit snapshots.
Browse files Browse the repository at this point in the history
Postponed creation of the final list of components.
Previously multiple independent components could sometimes be created.
  • Loading branch information
xsedla1o committed Feb 19, 2024
1 parent a117d33 commit 18ce44e
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions dp3/snapshots/snapshooter.py
Original file line number Diff line number Diff line change
Expand Up @@ -322,21 +322,22 @@ def get_linked_entities(self, time: datetime, cached_linked_entities: list[tuple
# Set linked as visited
visited_entities.update(linked_entities)

# Update component
# Update component, take all connected components into account
have_component = linked_entities & set(entity_to_component.keys())
if have_component:
for entity in have_component:
component = entity_to_component[entity]
component.update(linked_entities)
entity_to_component.update(
{entity: component for entity in linked_entities}
)
break
else:
entity_to_component.update(
{entity: linked_entities for entity in linked_entities}
)
linked_components.append(linked_entities)
linked_entities.update(component)
entity_to_component.update({entity: linked_entities for entity in linked_entities})

# Make a list of unique components
visited_entities.clear()
for entity, component in entity_to_component.items():
if entity in visited_entities:
continue
visited_entities.update(component)
linked_components.append(component)

return linked_components

def process_snapshot_task(self, msg_id, task: Snapshot):
Expand Down

0 comments on commit 18ce44e

Please sign in to comment.