-
-
Notifications
You must be signed in to change notification settings - Fork 594
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 potential delay in sending out requests from the rust SDK #3717
Conversation
This now happens as a side-effect of importing the keys.
There was a potential race which could cause us to be very slow to send out pending HTTP requests, particularly when handling a user verification. Add some resiliece to make sure we handle it correctly.
@@ -1304,6 +1311,8 @@ export class RustCrypto extends TypedEventEmitter<RustCryptoEvents, RustCryptoEv | |||
throw new Error("missing roomId in the event"); | |||
} | |||
|
|||
logger.debug(`Incoming verification event ${event.getId()} type ${event.getType()} from ${event.getSender()}`); |
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 was just some really useful debugging which I'm throwing in while I'm in the area.
Updated from develop to make the diff clearer, since the based-on PR is merged. (Hope that's ok) |
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 sensible and as described. Any way to test this?
return; | ||
} | ||
this.outgoingRequestLoopInner().catch((e) => { |
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.
Worth a comment saying we are deliberately not awaiting this here?
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 good to me. I've also tested device verification on the deployment. Works.
I suppose that writing tests for this edge case is not easily doable?
this.outgoingRequestLoopRunning = true; | ||
try { | ||
while (!this.stopped) { | ||
this.outgoingRequestLoopOneMoreLoop = false; |
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.
Can you add another short comment here? Because if you oversee the await
one may think that this.outgoingRequestLoopOneMoreLoop
is always false in the if
below.
I've added some comments, and a unit test. A proper integration test is a pain in the butt. |
There was a potential race which could cause us to be very slow to send out pending HTTP requests, particularly when handling a user verification. Add some resilience to make sure we handle it correctly.
Based on #3716This change is marked as an internal change (Task), so will not be included in the changelog.