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

refactor(ext/fetch): refactor fetch to use new write_error method #20029

Merged
merged 3 commits into from
Aug 3, 2023

Conversation

mmastrac
Copy link
Contributor

@mmastrac mmastrac commented Aug 2, 2023

This is a prerequisite for fast streams work -- this particular resource used a custom mpsc-style stream, and this work will allow us to unify it with the streams in ext/http in time.

Instead of using Option as an internal semaphore for "correctly completed EOF", we allow code to propagate errors into the channel which can be picked up by downstream sinks like Hyper. EOF is signalled using a more standard sender drop.

@mmastrac mmastrac marked this pull request as draft August 2, 2023 17:35
@mmastrac mmastrac marked this pull request as ready for review August 2, 2023 20:12
Copy link
Member

@bartlomieju bartlomieju left a comment

Choose a reason for hiding this comment

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

LGTM, with one question

Copy link
Member

Choose a reason for hiding this comment

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

Sweet to have it removed altogether 👍

@@ -293,7 +292,7 @@ where
match data {
None => {
// If no body is passed, we return a writer for streaming the body.
let (stream, tx) = MpscByteStream::new();
let (tx, stream) = tokio::sync::mpsc::channel(1);
Copy link
Member

Choose a reason for hiding this comment

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

Are you sure having a buffer size of 1 won't cause any dead locks?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's currently set to 1 in MpscByteStream, and I used the same number for ext/http as well. I think that I'd like to include a buffer here, but it would more likely be at the byte level rather than at the packet level.

Copy link
Member

Choose a reason for hiding this comment

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

Sounds reasonable 👍

@mmastrac mmastrac merged commit 7f8bf25 into denoland:main Aug 3, 2023
13 checks passed
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.

None yet

2 participants