Skip to content
Snippets Groups Projects
Commit 558a3f00 authored by Lluis Gifre Renom's avatar Lluis Gifre Renom
Browse files

Context component:

- corrected SetService when no endpoints are provided
parent 3eca13f7
No related branches found
No related tags found
2 merge requests!54Release 2.0.0,!34Context Scalability extensions using CockroachDB + Removal of Stateful database inside Device + other
......@@ -118,11 +118,12 @@ def service_set(db_engine : Engine, request : Service) -> Tuple[Dict, bool]:
created_at,updated_at = session.execute(stmt).fetchone()
updated = updated_at > created_at
stmt = insert(ServiceEndPointModel).values(service_endpoints_data)
stmt = stmt.on_conflict_do_nothing(
index_elements=[ServiceEndPointModel.service_uuid, ServiceEndPointModel.endpoint_uuid]
)
session.execute(stmt)
if len(service_endpoints_data) > 0:
stmt = insert(ServiceEndPointModel).values(service_endpoints_data)
stmt = stmt.on_conflict_do_nothing(
index_elements=[ServiceEndPointModel.service_uuid, ServiceEndPointModel.endpoint_uuid]
)
session.execute(stmt)
constraint_updates = upsert_constraints(session, constraints, service_uuid=service_uuid)
updated = updated or any([(updated_at > created_at) for created_at,updated_at in constraint_updates])
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment