-
Notifications
You must be signed in to change notification settings - Fork 4k
✨Introduce response stream writer util #28705
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
Conversation
| * @param {!WritableStreamDefaultWriter} writer | ||
| * @return {!Promise} | ||
| */ | ||
| export function streamResponseToWriter(win, response, writer) { |
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.
where is this used? could you add it to this PR?
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.
sure, was trying to keep it simple but can make a larger pr.
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.
was wondering how this method is going to be used. you can still leave TODOs in the caller to make the PR not too large.
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.
Added the calling context.
| </html> | ||
| `; | ||
|
|
||
| describes.fakeWin('streamResponseToWriter', {}, (env) => { |
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.
How do we want to handle an interrupted stream?
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 mean if the browser cancels the response? I'm not sure, but if that is the same as calling .cancel on the stream, the writer will be closed and if there is no content we will collapse the ad. If there is a body I think we will render a partial ad. If there is no cancel called I think we will just wait until we receive a body, though maybe we should time out. Not sure I am answering your question, let me know if you want to chat about this.
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 looks good. My only comment is that this could easily to into src/utils/.
|
Moved util to |
|
@dvoytenko friendly ping :) I need your approval now that the new files live in |
Takes a given response and writes it to a given writer. To be used for ad streaming.
Part of #27189