Skip to content

Commit 18ce44e

Browse files
committed
SnapShooter: Bugfix - occasional duplicit snapshots.
Postponed creation of the final list of components. Previously multiple independent components could sometimes be created.
1 parent a117d33 commit 18ce44e

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

dp3/snapshots/snapshooter.py

+12-11
Original file line numberDiff line numberDiff line change
@@ -322,21 +322,22 @@ def get_linked_entities(self, time: datetime, cached_linked_entities: list[tuple
322322
# Set linked as visited
323323
visited_entities.update(linked_entities)
324324

325-
# Update component
325+
# Update component, take all connected components into account
326326
have_component = linked_entities & set(entity_to_component.keys())
327327
if have_component:
328328
for entity in have_component:
329329
component = entity_to_component[entity]
330-
component.update(linked_entities)
331-
entity_to_component.update(
332-
{entity: component for entity in linked_entities}
333-
)
334-
break
335-
else:
336-
entity_to_component.update(
337-
{entity: linked_entities for entity in linked_entities}
338-
)
339-
linked_components.append(linked_entities)
330+
linked_entities.update(component)
331+
entity_to_component.update({entity: linked_entities for entity in linked_entities})
332+
333+
# Make a list of unique components
334+
visited_entities.clear()
335+
for entity, component in entity_to_component.items():
336+
if entity in visited_entities:
337+
continue
338+
visited_entities.update(component)
339+
linked_components.append(component)
340+
340341
return linked_components
341342

342343
def process_snapshot_task(self, msg_id, task: Snapshot):

0 commit comments

Comments
 (0)