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

Start ws-kalive loop after connection is established #403

Closed

Conversation

Snurppa
Copy link

@Snurppa Snurppa commented May 31, 2022

Now the :chsk/ws-ping go-loop starts before (connect-fn) is called.
If a connection in (connect-fn) can't be established right away, it will enter
(retry-fn) loop, until WS conn socket is established. Maybe it takes
forever, maybe it takes just 10 seconds for the remote end to come
online.

Meanwhile, we are sending ourselves the pings in ws-kalive-ms intervals.
Basically means log gets polluted with both:
"Chsk send against closed chsk." from the ws-ping send, and
"Chsk is closed: will try reconnect" from the connection retry-fn.

This change will start the go-loop only after we have returned from
(connect-fn).

Now the :chsk/ws-ping go-loop starts before `(connect-fn)` is called.
If connection in `(connect-fn)` can't be established right away, it will enter
`(retry-fn)` loop, until WS conn socket is established. Maybe it takes
forever, maybe it takes just 10 seconds for the remote end to come
online.

Meanwhile we are sending ourselves the pings in ws-kalive-ms intervals.
Basically means log gets polluted with both:
"Chsk send against closed chsk." from the ws-ping send, and
"Chsk is closed: will try reconnect" from the connection `retry-fn`.

This change will start the go-loop only after we have returned from
`(connect-fn)`.
@ptaoussanis ptaoussanis self-assigned this May 31, 2022
@ptaoussanis
Copy link
Member

@Snurppa Hi Joni, thanks for this - merging manually now!

ptaoussanis added a commit that referenced this pull request May 31, 2022
…rppa)

Before this commit:
  `:chsk/ws-ping` loop starts before (connect-fn) is called. This means that
  if there's some delay establishing connection, the logs get needlessly
  polluted with messages:
    - "Chsk send against closed chsk." from the ws-ping send.
    - "Chsk is closed: will try reconnect" from the connection retry-fn.

After this commit:
  Only start the ws-kalive loop after connection is established.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants