Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Access] Implement keepalive routine with ping-ponging to ws connection in ws controller #6757

Draft
wants to merge 16 commits into
base: master
Choose a base branch
from

Conversation

UlyanaAndrukhiv
Copy link
Contributor

@UlyanaAndrukhiv UlyanaAndrukhiv commented Nov 25, 2024

Closes: #6639

Note: ##6750 should be merged first

Context

In this pull request implemented a keepalive routine to monitor WebSocket network connectivity using ping-pong messages.

Key Changes

  • Integrated a keepalive logic with for WebSocket controller to detect and handle connectivity issues and ensured the keepalive operates independently, managing ping-pong messages and monitoring connection health.
  • Added mechanisms to disable the WebSocket connection and gracefully shut down affected components when issues are detected.
  • Added tests to validate connectivity issue detection and proper shutdown handling, including edge cases like missed pong responses and delayed ping intervals (in progress).

@codecov-commenter
Copy link

codecov-commenter commented Nov 25, 2024

Codecov Report

Attention: Patch coverage is 53.45622% with 101 lines in your changes missing coverage. Please review.

Project coverage is 41.92%. Comparing base (a164070) to head (afc8648).

Files with missing lines Patch % Lines
...ccess/rest/websockets/mock/websocket_connection.go 25.00% 54 Missing and 6 partials ⚠️
engine/access/rest/websockets/controller.go 66.96% 29 Missing and 8 partials ⚠️
engine/access/rest/websockets/connections.go 88.88% 2 Missing ⚠️
...access/rest/websockets/legacy/websocket_handler.go 66.66% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #6757      +/-   ##
==========================================
+ Coverage   39.71%   41.92%   +2.20%     
==========================================
  Files        1332     1655     +323     
  Lines      123050   153507   +30457     
==========================================
+ Hits        48875    64359   +15484     
- Misses      69986    83860   +13874     
- Partials     4189     5288    +1099     
Flag Coverage Δ
unittests 41.92% <53.45%> (+2.20%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@Guitarheroua Guitarheroua left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After the first round of review - looks cool!

}

c.dataProviders.Clear()
if err := c.conn.WriteMessage(websocket.PingMessage, nil); err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess what you need is WriteControl() method which accepts deadline as well

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Access] Implement keepalive routine with ping-ponging to ws connection in ws controller
4 participants