-
Notifications
You must be signed in to change notification settings - Fork 106
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
Automatically reconnect if we lose connection #81
Conversation
This needs much better retry logic, with back-offs and status messages. But fundamentally, it does already work \o/ Fixes #80
Excited about this bugfix! I think it would mean that a restart of for example a ingress-nginx or jupyterhub proxy pod would be handled more gracefully. |
let countDown = 5; | ||
setStatusText(`Reconnecting in ${countDown}s`); | ||
const intervalHandle = setInterval(() => { | ||
countDown -= 1; | ||
setStatusText(`Reconnecting in ${countDown}s`); | ||
console.log(countDown); | ||
if (countDown === 0) { | ||
clearInterval(intervalHandle); | ||
connect(); | ||
} | ||
}, 1000); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this could make sense to extract into a reconnect / attemptReconnect / handleDisconnect function or similar to improve readability.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For reference, I saw a retry backoff example in https://www.codewithyou.com/blog/how-to-implement-retry-with-exponential-backoff-in-nodejs#implementing-retry-with-exponential-backoff-from-scratch
I'll see if I can get this worked to completion before tuesday. The goal I have made explicit: to provide retry logic with backoff, verify function manually by changing network rules on the fly. |
I attempted for an hour or so but failed to make progress =/ |
Superceeded by #112 |
This needs much better retry logic, with back-offs and status messages. But fundamentally, it does already work \o/
Fixes #80