-
Notifications
You must be signed in to change notification settings - Fork 129
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: attempt to fix dangling broadcasts #428
Conversation
…try logic while connecting this should fix client-side causes of dangling broadcast project-slippi#427 note that I had some problems with electronmon intermittently detecting file changes for seemingly no reason, so I tested this with `electronmon` changed to just `electron` in the `"start:main"` rule of `package.json`
tested with local changes to trigger retry logic
- also fix possible bug with cleanup on stop(), since it's possible to have `this.wsConnection` and not `this.broadcastId` again, tested with local changes to trigger retry logic
Good news! I've confirmed in a long-running test that the retry logic works for real! Looks like it was able to recover after some sort of server hiccup?
But I think I should hook into the |
also properly dispose of ws client
updated! tested by pulling my ethernet cord lol
|
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.
only two things stick out to me, otherwise this is looking pretty good
@@ -305,10 +356,33 @@ export class BroadcastManager extends EventEmitter { | |||
}); | |||
|
|||
getBroadcasts().catch(console.warn); | |||
const postSocketConnectingSubStepRetry = () => { |
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.
this function is giving me pause atm. could you add some comments and explain why this needs to run constantly with setTimeout
and instead of only if getBroadcasts
fails?
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.
getBroadcasts
and startBroadcast
only fail if something goes wrong client-side, that is, if we fail to send the message. We expect the server to respond to both of these messages but because WebSockets simply deals with 'messages' or 'events' and doesn't use a request/response paradigm, there no notion of the server failing to respond to a message. Setting a simple exponential backoff retry covers all possible cases:
- failure to send
- server sends an unexpected/invalid/error response
- server sends nothing
Co-authored-by: Nikhil Narayana <[email protected]>
#427