fix(edgestacks): reorder operations to properly update the endpoint relations BE-11233 (#12239)

pull/12227/head
andres-portainer 2024-09-20 19:10:28 -03:00 committed by GitHub
parent 80f53ed6ec
commit cee997e0b3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 4 deletions

View File

@ -101,14 +101,14 @@ func (service *Service) PersistEdgeStack(
stack.EntryPoint = composePath
stack.NumDeployments = len(relatedEndpointIds)
if err := service.updateEndpointRelations(tx, stack.ID, relatedEndpointIds); err != nil {
return nil, fmt.Errorf("unable to update endpoint relations: %w", err)
}
if err := tx.EdgeStack().Create(stack.ID, stack); err != nil {
return nil, err
}
if err := service.updateEndpointRelations(tx, stack.ID, relatedEndpointIds); err != nil {
return nil, fmt.Errorf("unable to update endpoint relations: %w", err)
}
return stack, nil
}