Skip to content

Commit 46d9e6f

Browse files
committed
Add more log in case of disconnection
1 parent 02d5f55 commit 46d9e6f

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

src/contexts/HttpQueueContext.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ import { useWsContext } from "./WsContext"
2424
import { useTargetContext } from "../targets"
2525

2626
let counterNoAnswer = 0
27+
const MaxNoAnswerNb = 4
28+
2729
/*
2830
* Local const
2931
*
@@ -105,7 +107,8 @@ const HttpQueueContextProvider = ({ children }) => {
105107
} else {
106108
if (!e.code) {
107109
counterNoAnswer++
108-
if (counterNoAnswer > 3) {
110+
console.log("Connection lost ?", counterNoAnswer)
111+
if (counterNoAnswer > MaxNoAnswerNb) {
109112
Disconnect("connectionlost")
110113
}
111114
}

src/contexts/WsContext.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,8 +170,12 @@ const WsContextProvider = ({ children }) => {
170170
//seems sometimes it disconnect so wait 3s and reconnect
171171
//if it is not a log off
172172
if (!isLogOff.current) {
173-
if (!isPingPaused) reconnectCounter.current++
173+
if (!isPingPaused) {
174+
reconnectCounter.current++
175+
console.log("reconnecting ", reconnectCounter.current)
176+
}
174177
if (reconnectCounter.current >= maxReconnections) {
178+
console.log("Reconnection over ", maxReconnections)
175179
Disconnect("connectionlost")
176180
} else {
177181
console.log("Ws connection lost")

0 commit comments

Comments
 (0)