Skip to content

Commit

Permalink
Updated return statements to latest changes
Browse files Browse the repository at this point in the history
  • Loading branch information
UlyanaAndrukhiv committed Dec 16, 2024
1 parent ac529ad commit 911e6cd
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
4 changes: 2 additions & 2 deletions engine/access/rest/websockets/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ func (c *Controller) keepalive(ctx context.Context) error {
for {
select {
case <-ctx.Done():
return ctx.Err()
return nil
case <-pingTicker.C:
err := c.conn.WriteControl(websocket.PingMessage, time.Now().Add(WriteWait))
if err != nil {
Expand Down Expand Up @@ -158,7 +158,7 @@ func (c *Controller) writeMessages(ctx context.Context) error {
for {
select {
case <-ctx.Done():
return ctx.Err()
return nil
case message, ok := <-c.multiplexedStream:
if !ok {
return fmt.Errorf("multiplexed stream closed")
Expand Down
3 changes: 1 addition & 2 deletions engine/access/rest/websockets/controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -896,8 +896,7 @@ func (s *WsControllerSuite) TestKeepaliveRoutine() {

// Start the keepalive process with the context canceled
err := controller.keepalive(ctx)
s.Require().Error(err)
s.Require().ErrorIs(context.Canceled, err) //TODO: should be nil
s.Require().NoError(err)

conn.AssertExpectations(t) // Should not invoke WriteMessage after context cancellation
})
Expand Down

0 comments on commit 911e6cd

Please sign in to comment.