-
Notifications
You must be signed in to change notification settings - Fork 357
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
feat: [M3-8722] - Improve weblish retry behavior #11067
base: develop
Are you sure you want to change the base?
Conversation
* automatically reconnect weblish sessions that have disconnected * … unless it fails rapidly (more than 3 times in a 1 minute window) * … in which case show an error screen with as much information as we can provide * … where the error screen includes a button to try again. * focus the terminal element when starting (which is generally helpful but also prevents _losing_ focus after a reconnect) Previously, a failure would often just result in a spinning circle forever.
Coverage Report: ❌ |
…Error`. Break the `formatError` logic into two separate function that compute the two parts of the output, and then the main function just appends them. Adopt the preferred `const x = () =>` syntax in lieu of `function x()` syntax.
…s as its own, separate interface.
…iable as suggested in code review.
…d of `class` for `RetryLimiter`.
* Remove comments for obvious fields * `actionButton` => `actionButtonProps` * Combine `try` cases when parsing errors
* Add spaces around `=>` types. * Remove unnecessary `Optional Action Button` comment. * Refactor error handling using new `ParsePotentialLishErrorString` and `LishErrorInterface`. This centralizes all of the code to check structure and type of errors in one place. This may also prove using for future improvements to graphical lish. * Flatten websocket `close` handler logic from if-if-else-else structure to if-return-if-return-return.
{ | ||
const reason = parsed?.reason; | ||
if (parsed?.type === "error" && typeof reason === "string") { | ||
return { | ||
reason: reason, | ||
grn: grn, | ||
formatted: reason + grnFormatted, | ||
isExpired: reason.toLowerCase() === "your session has expired." | ||
}; | ||
} | ||
} | ||
{ | ||
const reason = parsed?.errors?.[0]?.reason; | ||
if (typeof reason === "string") { | ||
return { | ||
reason: reason, | ||
grn: grn, | ||
formatted: `Error code: ${reason}${grnFormatted}`, | ||
isExpired: reason === "expired" | ||
}; | ||
} | ||
} |
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.
What's the difference between these two cases?
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.
The error may take one of two different formats. {"type":"error","reason":"..."}
or {"errors":[{"reason":"..."}]}
. The "expired" case can occur with either format, but the message to check is slightly different. The formatting is also slightly different because the first form tends to output descriptive errors, whereas the second from outputs one-word codes. (Currently, only the second form sends grn
trace information, but I wanted to leave the option of adding it to the first, so the grn
is currently handled outside of those two cases.)
* Remove second error format: It turns out that it will not be too difficult to make all of the errors follow the same basic format, so we don't need two separate parsers. Yay!
Description 📝
Previously, a failure would often just result in a spinning circle forever.
Changes 🔄
List any change relevant to the reviewer.
Lish.tsx
which may also be useful for similar enhancements to graphical lish (glish) in the future.socket
to be mutable and nullable so it can be updated when reconnecting.origSocket
local variable is used to ensure that “stale” events are properly ignored.close
handler, which also eliminates the potential for console output that too closely matches an "expired" error being interpreted as an error and breaking the session immediately.Target release date 🗓️
TBD.
Preview 📷
How to test 🧪
Prerequisites
Running linode(s).
Reproduction steps
Launch a lish session for a machine, type
^a d kill <enter>
. The session will exit and show a spinning circle.Verification steps
^a d kill <enter>
. The session will reconnect.As an Author I have considered 🤔
Check all that apply