mirror of
https://github.com/portainer/portainer.git
synced 2025-07-24 15:59:41 +02:00
feat(transactions): remove the feature flag EE-6080 (#10257)
This commit is contained in:
parent
e83aa4d88d
commit
c748385879
28 changed files with 123 additions and 384 deletions
|
@ -6,7 +6,6 @@ import (
|
|||
|
||||
portainer "github.com/portainer/portainer/api"
|
||||
"github.com/portainer/portainer/api/dataservices"
|
||||
"github.com/portainer/portainer/pkg/featureflags"
|
||||
httperror "github.com/portainer/portainer/pkg/libhttp/error"
|
||||
"github.com/portainer/portainer/pkg/libhttp/request"
|
||||
"github.com/portainer/portainer/pkg/libhttp/response"
|
||||
|
@ -58,15 +57,10 @@ func (handler *Handler) endpointGroupCreate(w http.ResponseWriter, r *http.Reque
|
|||
}
|
||||
|
||||
var endpointGroup *portainer.EndpointGroup
|
||||
if featureflags.IsEnabled(portainer.FeatureNoTx) {
|
||||
endpointGroup, err = handler.createEndpointGroup(handler.DataStore, payload)
|
||||
} else {
|
||||
err = handler.DataStore.UpdateTx(func(tx dataservices.DataStoreTx) error {
|
||||
endpointGroup, err = handler.createEndpointGroup(tx, payload)
|
||||
return err
|
||||
})
|
||||
}
|
||||
|
||||
err = handler.DataStore.UpdateTx(func(tx dataservices.DataStoreTx) error {
|
||||
endpointGroup, err = handler.createEndpointGroup(tx, payload)
|
||||
return err
|
||||
})
|
||||
if err != nil {
|
||||
var httpErr *httperror.HandlerError
|
||||
if errors.As(err, &httpErr) {
|
||||
|
@ -119,20 +113,6 @@ func (handler *Handler) createEndpointGroup(tx dataservices.DataStoreTx, payload
|
|||
}
|
||||
|
||||
for _, tagID := range endpointGroup.TagIDs {
|
||||
if featureflags.IsEnabled(portainer.FeatureNoTx) {
|
||||
err = tx.Tag().UpdateTagFunc(tagID, func(tag *portainer.Tag) {
|
||||
tag.EndpointGroups[endpointGroup.ID] = true
|
||||
})
|
||||
|
||||
if tx.IsErrObjectNotFound(err) {
|
||||
return nil, httperror.InternalServerError("Unable to find a tag inside the database", err)
|
||||
} else if err != nil {
|
||||
return nil, httperror.InternalServerError("Unable to persist tag changes inside the database", err)
|
||||
}
|
||||
|
||||
continue
|
||||
}
|
||||
|
||||
tag, err := tx.Tag().Read(tagID)
|
||||
if err != nil {
|
||||
return nil, httperror.InternalServerError("Unable to find a tag inside the database", err)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue