Skip to content

Commit

Permalink
[#403][Fix] Start ws-kalive loop only after conn is established (@Snu…
Browse files Browse the repository at this point in the history
…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.
  • Loading branch information
ptaoussanis committed May 31, 2022
1 parent 34ca179 commit 712046f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/taoensso/sente.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -1290,6 +1290,9 @@

(reset! socket_ ?socket))))))]

(reset! retry-count_ 0)
(connect-fn)

(when-let [ms ws-kalive-ms]
(go-loop []
(let [udt-t0 @udt-last-comms_]
Expand All @@ -1308,8 +1311,6 @@
(-chsk-send! chsk [:chsk/ws-ping] {:flush? true})))
(recur)))))

(reset! retry-count_ 0)
(connect-fn)
chsk)))

(defn- new-ChWebSocket [opts csrf-token]
Expand Down

0 comments on commit 712046f

Please sign in to comment.