mirror of
https://github.com/portainer/portainer.git
synced 2025-07-24 07:49:41 +02:00
fix(performance): optimize performance for edge EE-3311 (#8040)
This commit is contained in:
parent
3d28a6f877
commit
dd0d1737b0
23 changed files with 577 additions and 164 deletions
|
@ -28,16 +28,10 @@ func (handler *Handler) endpointCreateGlobalKey(w http.ResponseWriter, r *http.R
|
|||
|
||||
// Search for existing endpoints for the given edgeID
|
||||
|
||||
endpoints, err := handler.DataStore.Endpoint().Endpoints()
|
||||
if err != nil {
|
||||
return httperror.InternalServerError("Unable to retrieve the endpoints from the database", err)
|
||||
endpointID, ok := handler.DataStore.Endpoint().EndpointIDByEdgeID(edgeID)
|
||||
if ok {
|
||||
return response.JSON(w, endpointCreateGlobalKeyResponse{endpointID})
|
||||
}
|
||||
|
||||
for _, endpoint := range endpoints {
|
||||
if endpoint.EdgeID == edgeID {
|
||||
return response.JSON(w, endpointCreateGlobalKeyResponse{endpoint.ID})
|
||||
}
|
||||
}
|
||||
|
||||
return httperror.NotFound("Unable to find the endpoint in the database", err)
|
||||
return httperror.NotFound("Unable to find the endpoint in the database", nil)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue