diff --git a/models/sys/vm/gpu/client.go b/models/sys/vm/gpu/client.go index 33f17f8f..9be527ed 100644 --- a/models/sys/vm/gpu/client.go +++ b/models/sys/vm/gpu/client.go @@ -23,6 +23,14 @@ func New() *Client { } func NewWithExclusion(excludedHosts []string, excludedGPUs []string) *Client { + if excludedHosts == nil { + excludedHosts = make([]string, 0) + } + + if excludedGPUs == nil { + excludedGPUs = make([]string, 0) + } + return &Client{ ExcludedHosts: excludedHosts, ExcludedGPUs: excludedGPUs, diff --git a/routers/api/v1/v1_deployment/logs.go b/routers/api/v1/v1_deployment/logs.go index b54cc60b..c197805e 100644 --- a/routers/api/v1/v1_deployment/logs.go +++ b/routers/api/v1/v1_deployment/logs.go @@ -65,7 +65,9 @@ func GetLogs(c *gin.Context) { case websocket.CloseNormalClosure, websocket.CloseGoingAway, websocket.CloseNoStatusReceived: - logContext.Done() + if logContext != nil { + logContext.Done() + } log.Println("websocket closed for deployment ", requestURI.DeploymentID) return }