fix(mercury): gracefully handle mercury rebalancing - #5106
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8e0f835eee
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
This pull request is automatically being deployed by Amplify Hosting (learn more). |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9c0d1145da
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 56582c3011
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| this.logger.info(`${this.namespace}: socket ${sessionId} replaced; will not reconnect`); | ||
| if (isActiveSocket) this._emit(sessionId, 'offline.replaced', event); | ||
| // If not active, nothing to do | ||
| if (reason === 'replaced') { |
There was a problem hiding this comment.
Nitpick: The comparison reason === 'replaced' is case-sensitive. If there's any chance the server could send 'Replaced' or 'REPLACED', a safer check would be:
if (reason?.toLowerCase() === 'replaced')
There was a problem hiding this comment.
yes, its already there at declaration const reason = event.reason && event.reason.toLowerCase();
shnaaz
left a comment
There was a problem hiding this comment.
Left a minor comment, can you please address bot's comments
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 63518cacfa
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Thank you for your contribution! |
COMPLETES #N/A
This pull request addresses
Mercury close code
4000is not always a signal that the current SDK context should reconnect. According to Mercury connection behavior,4000with close reasonReplacedmeans another connection already replaced the current registration, so this older connection should stand down. A4000with any other reason should be treated as an unexpected close and reconnect.by making the following changes
4000.4000with reasonReplacedby emittingoffline.replaced.4000with any other reason by emittingoffline.transientand calling_reconnect().4000/Replaced,4000with an unknown reason, and non-active socket close handling.Change Type
The following scenarios were tested
yarn workspace @webex/internal-plugin-mercury test:unit --targets mercury.jspassed with100 passing.yarn workspace @webex/internal-plugin-mercury test:stylecompleted with no errors and one existing JSDoc warning insrc/index.js.The GAI Coding Policy And Copyright Annotation Best Practices
I certified that
Make sure to have followed the contributing guidelines before submitting.