Skip to content

Commit

Permalink
Simplify return signature of functions that can't actually return err…
Browse files Browse the repository at this point in the history
…ors anyways (because of goroutines)
  • Loading branch information
cmmarslender committed Mar 16, 2024
1 parent b207b98 commit b998da5
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions pkg/websocketclient/websocketclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -373,12 +373,7 @@ func (c *WebsocketClient) ensureConnection() error {
}
}

go func() {
err := c.listen()
if err != nil {
log.Printf("Error calling listen: %s\n", err.Error())
}
}()
go c.listen()

return nil
}
Expand All @@ -387,7 +382,7 @@ func (c *WebsocketClient) ensureConnection() error {
// The error returned from this function would only correspond to an error setting up the listener
// Errors returned by ReadMessage, or some other part of the websocket request/response will be
// passed to the handler to deal with
func (c *WebsocketClient) listen() error {
func (c *WebsocketClient) listen() {
if !c.listenSyncActive {
c.listenSyncActive = true
defer func() {
Expand Down Expand Up @@ -426,6 +421,4 @@ func (c *WebsocketClient) listen() error {
go c.handlerProxy(resp, err)
}
}

return nil
}

0 comments on commit b998da5

Please sign in to comment.