fix(pending-actions): clean pending actions for deleted environment [EE-6545] (#11600)

This commit is contained in:
Prabhat Khera
2024-04-17 08:32:32 +12:00
committed by GitHub
parent 1a801d86f0
commit fb4ffaec35
8 changed files with 82 additions and 2 deletions

View File

@@ -179,6 +179,12 @@ func (handler *Handler) deleteEndpoint(tx dataservices.DataStoreTx, endpointID p
}
}
// delete the pending actions
err = tx.PendingActions().DeleteByEndpointID(endpoint.ID)
if err != nil {
log.Warn().Err(err).Int("endpointId", int(endpoint.ID)).Msgf("Unable to delete pending actions")
}
err = tx.Endpoint().DeleteEndpoint(portainer.EndpointID(endpointID))
if err != nil {
return httperror.InternalServerError("Unable to delete the environment from the database", err)