feature: Refactors backend runtime's communication mechanism to be more stable.
This commit is contained in:
parent
93f2f9cbee
commit
1e1a330a4b
10 changed files with 254 additions and 157 deletions
|
@ -118,19 +118,19 @@ func GetConnections(c *gin.Context) {
|
|||
return
|
||||
}
|
||||
|
||||
backendRuntime.RuntimeCommands <- &commonbackend.ProxyConnectionsRequest{
|
||||
backendResponse, err := backendRuntime.ProcessCommand(&commonbackend.ProxyConnectionsRequest{
|
||||
Type: "proxyConnectionsRequest",
|
||||
}
|
||||
})
|
||||
|
||||
backendResponse := <-backendRuntime.RuntimeCommands
|
||||
|
||||
switch responseMessage := backendResponse.(type) {
|
||||
case error:
|
||||
log.Warnf("Failed to get response for backend: %s", responseMessage.Error())
|
||||
if err != nil {
|
||||
log.Warnf("Failed to get response for backend: %s", err.Error())
|
||||
|
||||
c.JSON(http.StatusInternalServerError, gin.H{
|
||||
"error": "Failed to get status response from backend",
|
||||
})
|
||||
}
|
||||
|
||||
switch responseMessage := backendResponse.(type) {
|
||||
case *commonbackend.ProxyConnectionsResponse:
|
||||
sanitizedConnections := []*SanitizedConnection{}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue