Skip to content

[DF-21594]update the ws reconnect logic and adding explicit logging#547

Merged
guandali merged 2 commits intomainfrom
chore/lli/harden-ws-reconnect
Sep 2, 2025
Merged

[DF-21594]update the ws reconnect logic and adding explicit logging#547
guandali merged 2 commits intomainfrom
chore/lli/harden-ws-reconnect

Conversation

@guandali
Copy link
Member

@guandali guandali commented Aug 25, 2025

related to reported bug here: DF-21594 icap EAs appears hung over the weekend

Slack discussion

Some identified issue:

What changed in this PR

  • update lastMessageReceivedAt whenever receives an update
  • ensure proper close of active ws before proceed to open a new one.

@guandali guandali requested a review from a team as a code owner August 25, 2025 15:39
@github-actions
Copy link
Contributor

👋 guandali, thanks for creating this pull request!

To help reviewers, please consider creating future PRs as drafts first. This allows you to self-review and make any final changes before notifying the team.

Once you're ready, you can mark it as "Ready for review" to request feedback. Thanks!

@github-actions
Copy link
Contributor

github-actions bot commented Aug 25, 2025

NPM Publishing labels 🏷️

🟢 This PR has valid version labels and will cause a minor bump.

lastMessageReceivedAt = 0
connectionOpenedAt = 0

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?

const timeSinceLastMessage = Math.max(0, now - this.lastMessageReceivedAt)
const timeSinceConnectionOpened = Math.max(0, now - this.connectionOpenedAt)
// Explicit initial grace (1s) after open; after that, rely on "time since last message"
const INITIAL_GRACE_MS = 1000
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Put this somewhere else

await new Promise<void>((resolve) => {
this.wsConnection!.once('close', () => resolve())
try {
this.wsConnection!.close(1000)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you want to use INITIAL_GRACE_MS here as well?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

its a standard code for normal closing of ws

@mxiao-cll
Copy link
Contributor

Need more details on what the changes are

@guandali guandali changed the title update the ws reconnect logic and adding explicit logging [DF-21594]update the ws reconnect logic and adding explicit logging Aug 26, 2025
@guandali guandali force-pushed the chore/lli/harden-ws-reconnect branch from 4b7f1ce to d722bcb Compare August 27, 2025 07:35
@guandali guandali requested a review from mxiao-cll August 27, 2025 15:15
@guandali
Copy link
Member Author

@mxiao-cll hey Michael, thank you for the review and i have added more context and address ed your comment

@cawthorne
Copy link
Contributor

It seems reasonable to me. We should make sure this is tested on Staging before it goes to Production.

@guandali guandali added the minor label Aug 27, 2025
@guandali guandali merged commit 6d5d449 into main Sep 2, 2025
15 checks passed
@github-actions
Copy link
Contributor

github-actions bot commented Sep 2, 2025

🚀 Successfully created version bump PR: #525

@mxiao-cll mxiao-cll deleted the chore/lli/harden-ws-reconnect branch October 5, 2025 21:39
cawthorne added a commit that referenced this pull request Oct 20, 2025
cawthorne added a commit that referenced this pull request Oct 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants