Skip to content

Commit

Permalink
ignore websocket close errors (#790)
Browse files Browse the repository at this point in the history
  • Loading branch information
frostbyte73 authored Oct 9, 2024
1 parent 1257cc6 commit cedb6d8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pkg/pipeline/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ func (c *Controller) Run(ctx context.Context) *info.EgressInfo {
logger.Debugw("closing sinks")
for _, si := range c.sinks {
for _, s := range si {
if err := s.Close(); err != nil && c.playing.IsBroken() {
if err := s.Close(); err != nil && c.playing.IsBroken() && c.FinalizationRequired {
c.Info.SetFailed(err)
return c.Info
}
Expand Down
4 changes: 3 additions & 1 deletion pkg/pipeline/sink/websocket.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,11 +206,13 @@ func (s *WebsocketSink) Close() error {
s.mu.Lock()
defer s.mu.Unlock()
if !s.closed.Swap(true) {
logger.Debugw("closing websocket connection")

// write close message for graceful disconnection
_ = s.conn.WriteMessage(websocket.CloseMessage, nil)

// terminate connection and close the `closed` channel
return s.conn.Close()
_ = s.conn.Close()
}

return nil
Expand Down

0 comments on commit cedb6d8

Please sign in to comment.