Open nvkets opened 8 years ago
I can confirm that this issue is also present in the caspar-cg system we are running. When casparcg goes down for a longer period of time node-caspar-cg will keep making two connection attempts at every time-out resulting in a doubling of connections every iteration.
Eventually the process depending on node-caspar-cg will run out of memory and crash, or when casparcg comes back on the air it suddenly receives hundreds of incoming connections.
Would be great if tkupari's pull request could be merged because it seems to be an adequate solution.
If a connection is made with the reconnectionInterval option set, an issue arises when the CasparCG service is not available:
timeout is called on 'connectionError' and on 'disconnected', creating 2 timeouts to retry reconnect.
these number of retries keep on growing, since every timeout creates 2 new timeouts.
Proposed solution: only set reconnect timeout on connectionError OR disconnect?