Skip to content
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

add tests for handlers cleanly exiting #267

Merged
merged 6 commits into from
Sep 5, 2024

Conversation

jackyzha0
Copy link
Member

Why

What changed

Versioning

  • Breaking protocol change
  • Breaking ts/js API change

@jackyzha0 jackyzha0 requested a review from a team as a code owner September 5, 2024 00:43
@jackyzha0 jackyzha0 requested review from masad-frost and removed request for a team September 5, 2024 00:43
router/server.ts Outdated
@@ -595,6 +598,8 @@ class RiverServer<Services extends AnyServiceSchemaMap>
reqReadable,
resWritable,
});

resWritable.close();
Copy link
Member

Choose a reason for hiding this comment

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

Hmm, why?

} else if (procedure.type === 'rpc' || procedure.type === 'subscription') {
// Though things can work just fine if they eventually follow up with a stream
// control message with a close bit set, it's an unusual client implementation!
this.log?.warn('sent an init without a stream close', loggingMetadata);
Copy link
Member Author

Choose a reason for hiding this comment

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

this was noise and didnt tell us anything

Copy link
Member

Choose a reason for hiding this comment

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

Ye

router/server.ts Outdated
@@ -647,6 +654,7 @@ class RiverServer<Services extends AnyServiceSchemaMap>
}

resWritable.write(responsePayload);
resWritable.close();
Copy link
Member Author

Choose a reason for hiding this comment

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

extra safety

router/server.ts Outdated
if (!newStream.endedSignal.aborted) {
// if the stream was immediately aborted, don't bother setting it up
this.streams.set(streamId, newStream);
}
Copy link
Member Author

Choose a reason for hiding this comment

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

handle cases where we exited from the stream before we set here

@jackyzha0 jackyzha0 merged commit 1bc1ce9 into main Sep 5, 2024
4 checks passed
@jackyzha0 jackyzha0 deleted the jackyzha0/clean-handler-ctx-tests branch September 5, 2024 01:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants