Loading src/context/service/database/Device.py +3 −1 Original line number Diff line number Diff line Loading @@ -171,7 +171,9 @@ def device_set(db_engine : Engine, request : Device) -> Tuple[Dict, bool]: endpoint_updates = session.execute(stmt).fetchall() updated_endpoints = any([(updated_at > created_at) for created_at,updated_at in endpoint_updates]) if len(related_topologies) > 0: if not updated or len(related_topologies) > 1: # Only update topology-device relations when device is created (not updated) or when endpoints are # modified (len(related_topologies) > 1). session.execute(insert(TopologyDeviceModel).values(related_topologies).on_conflict_do_nothing( index_elements=[TopologyDeviceModel.topology_uuid, TopologyDeviceModel.device_uuid] )) Loading Loading
src/context/service/database/Device.py +3 −1 Original line number Diff line number Diff line Loading @@ -171,7 +171,9 @@ def device_set(db_engine : Engine, request : Device) -> Tuple[Dict, bool]: endpoint_updates = session.execute(stmt).fetchall() updated_endpoints = any([(updated_at > created_at) for created_at,updated_at in endpoint_updates]) if len(related_topologies) > 0: if not updated or len(related_topologies) > 1: # Only update topology-device relations when device is created (not updated) or when endpoints are # modified (len(related_topologies) > 1). session.execute(insert(TopologyDeviceModel).values(related_topologies).on_conflict_do_nothing( index_elements=[TopologyDeviceModel.topology_uuid, TopologyDeviceModel.device_uuid] )) Loading