mirror of https://github.com/portainer/portainer
fix(polling): clean up the logic for correctness and performance EE-5700 (#9169)
parent
29c1862754
commit
eefb4c4287
|
@ -27,6 +27,8 @@ func (service ServiceTx) Endpoint(ID portainer.EndpointID) (*portainer.Endpoint,
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
endpoint.LastCheckInDate, _ = service.service.Heartbeat(ID)
|
||||||
|
|
||||||
return &endpoint, nil
|
return &endpoint, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -98,6 +98,13 @@ func (handler *Handler) endpointEdgeStatusInspect(w http.ResponseWriter, r *http
|
||||||
return httperror.Forbidden("Permission denied to access environment", err)
|
return httperror.Forbidden("Permission denied to access environment", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
handler.DataStore.Endpoint().UpdateHeartbeat(endpoint.ID)
|
||||||
|
|
||||||
|
err = handler.requestBouncer.TrustedEdgeEnvironmentAccess(handler.DataStore, endpoint)
|
||||||
|
if err != nil {
|
||||||
|
return httperror.Forbidden("Permission denied to access environment", err)
|
||||||
|
}
|
||||||
|
|
||||||
var statusResponse *endpointEdgeStatusInspectResponse
|
var statusResponse *endpointEdgeStatusInspectResponse
|
||||||
if featureflags.IsEnabled(portainer.FeatureNoTx) {
|
if featureflags.IsEnabled(portainer.FeatureNoTx) {
|
||||||
statusResponse, err = handler.inspectStatus(handler.DataStore, r, portainer.EndpointID(endpointID))
|
statusResponse, err = handler.inspectStatus(handler.DataStore, r, portainer.EndpointID(endpointID))
|
||||||
|
@ -126,11 +133,6 @@ func (handler *Handler) inspectStatus(tx dataservices.DataStoreTx, r *http.Reque
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
err = handler.requestBouncer.TrustedEdgeEnvironmentAccess(tx, endpoint)
|
|
||||||
if err != nil {
|
|
||||||
return nil, httperror.Forbidden("Permission denied to access environment", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
if endpoint.EdgeID == "" {
|
if endpoint.EdgeID == "" {
|
||||||
edgeIdentifier := r.Header.Get(portainer.PortainerAgentEdgeIDHeader)
|
edgeIdentifier := r.Header.Get(portainer.PortainerAgentEdgeIDHeader)
|
||||||
endpoint.EdgeID = edgeIdentifier
|
endpoint.EdgeID = edgeIdentifier
|
||||||
|
|
Loading…
Reference in New Issue