1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-07-24 07:49:41 +02:00

fix deadlock situation (#10360)

This commit is contained in:
Prabhat Khera 2023-09-22 16:06:20 +12:00 committed by GitHub
parent fb7a2fbbe6
commit ec091efe3b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -155,12 +155,16 @@ func (handler *Handler) updateEndpointGroup(tx dataservices.DataStoreTx, endpoin
err = handler.AuthorizationService.CleanNAPWithOverridePolicies(tx, &endpoint, endpointGroup)
if err != nil {
// Update flag with endpoint and continue
handler.PendingActionsService.Create(portainer.PendingActions{
EndpointID: endpoint.ID,
Action: "CleanNAPWithOverridePolicies",
ActionData: endpointGroup.ID,
})
log.Warn().Err(err).Msgf("Unable to update user authorizations for endpoint (%d) and endpoint group (%d).", endpoint.ID, endpointGroup.ID)
go func(endpointID portainer.EndpointID, endpointGroupID portainer.EndpointGroupID) {
err := handler.PendingActionsService.Create(portainer.PendingActions{
EndpointID: endpointID,
Action: "CleanNAPWithOverridePolicies",
ActionData: endpointGroupID,
})
if err != nil {
log.Error().Err(err).Msgf("Unable to create pending action to clean NAP with override policies for endpoint (%d) and endpoint group (%d).", endpointID, endpointGroupID)
}
}(endpoint.ID, endpointGroup.ID)
}
}
}