-
Notifications
You must be signed in to change notification settings - Fork 22
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
fix: CIRA connection race condition and add 30 sec keepalive time #535
Conversation
src/server/mpsserver.ts
Outdated
@@ -177,7 +184,9 @@ export class MPSServer { | |||
onClose = async (socket: CIRASocket): Promise<void> => { | |||
logger.debug('MPS:CIRA connection closed') | |||
try { | |||
await this.handleDeviceDisconnect(socket.tag.nodeid) | |||
if (devices[socket.tag.nodeid]?.ciraSocket?.tag.id === socket?.tag.id) { |
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.
Do you think we should log on the else condition to know when this is happening?
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.
Yes, I think it will be good to have that. Should I do a separate PR for adding/modifying logs around CIRA connections (especially around all socket events)?
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 would do it as part of this one.
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've added extra logging around cira connection events with the new commit, let me know your feedback on the changes
Codecov Report
@@ Coverage Diff @@
## main #535 +/- ##
==========================================
- Coverage 91.24% 86.88% -4.36%
==========================================
Files 68 66 -2
Lines 2959 2837 -122
Branches 449 475 +26
==========================================
- Hits 2700 2465 -235
- Misses 259 355 +96
- Partials 0 17 +17
Continue to review full report at Codecov.
|
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.
Looks like you need to add some missing unit tests
|
PR Checklist
What are you changing?
Fix race condition that happens during a CIRA reconnect
Configure 30 sec keepalive/heartbeat time for all CIRA connections
Anything the reviewer should know when reviewing this PR?
If the there are associated PRs in other repositories, please link them here (i.e. open-amt-cloud-toolkit/repo#365 )