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

Draft: Wait for WebSocket connection to open before sending #15211

Draft
wants to merge 7 commits into
base: devel
Choose a base branch
from

Conversation

ranvit
Copy link

@ranvit ranvit commented May 21, 2024

SUMMARY

This change enhances the WebSocket connection handling in the UI by ensuring messages are only sent when the WebSocket is fully open. This improves stability, and might help address the recurring issues of job logs failing to live-refresh

TODO: insert all the issues in operator and base repo that mention job logs not refreshing, websocket errors, DOMException errors

ISSUE TYPE
  • Bug, Docs Fix or other nominal change
COMPONENT NAME
  • UI
AWX VERSION
v23,9.0
ADDITIONAL INFORMATION

Key Changes:

  • In the onopen event, the ws.send is wrapped with a check to ensure that the WebSocket is open before sending the message. This should prevent the error related to the WebSocket being in the CONNECTING state.
  • Move WebSocket creation inside connect function: This ensures a new WebSocket is instantiated during reconnection.
  • Check WebSocket state before sending: Ensures messages are only sent when the WebSocket is open.
  • Correctly set ws.current to a new WebSocket instance on reconnection: Ensures the reference is updated for each new connection.

@TheRealHaoLiu TheRealHaoLiu marked this pull request as draft May 22, 2024 19:02
@TheRealHaoLiu
Copy link
Member

converting to draft PR due to title, @ranvit once its ready please put it in ready for review

hb9hnt and others added 5 commits May 22, 2024 19:27
…) to fix human output on Python 3.12 (ansible#15170)

Replace deprecated locale.format with locale.format_string

This will be removed in Python 3.12 and will break human output unless fixed.
Wrap long line to fit description window (ansible#14597)

Co-authored-by: Ирина Розет <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants