Fix panics due to concurrent websocket writes

This commit is contained in:
Lubos Dolezel
2023-02-24 11:49:26 +01:00
parent 8bee96aeff
commit f27cbfb299
21 changed files with 131 additions and 141 deletions

View File

@@ -3,9 +3,9 @@ package gomeassistant
import (
"context"
"github.com/gorilla/websocket"
"saml.dev/gome-assistant/internal/http"
"saml.dev/gome-assistant/internal/services"
ws "saml.dev/gome-assistant/internal/websocket"
)
type Service struct {
@@ -28,7 +28,7 @@ type Service struct {
Vacuum *services.Vacuum
}
func newService(conn *websocket.Conn, ctx context.Context, httpClient *http.HttpClient) *Service {
func newService(conn *ws.WebsocketWriter, ctx context.Context, httpClient *http.HttpClient) *Service {
return &Service{
AlarmControlPanel: services.BuildService[services.AlarmControlPanel](conn, ctx),
Cover: services.BuildService[services.Cover](conn, ctx),