-
-
Notifications
You must be signed in to change notification settings - Fork 34.7k
[x] http: bytesWritten for http/1 and compat #28004
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
addaleax
left a comment
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.
LGTM with 1 request
683804b to
8720c1c
Compare
|
Would be nice to add |
BridgeAR
left a comment
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 seems to require some documentation?
|
Ping @ronag |
b627fb5 to
5d10298
Compare
|
@BridgeAR docs added |
5d10298 to
c5cfabf
Compare
|
@nodejs/http @nodejs/http2 |
mcollina
left a comment
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.
I don't think this is compatible with the approach in #27988. If we think we should add bytesRead to Readable, we should add bytesWritten to Writable.
|
@mcollina What do you mean? http/1 does not inherit from |
c5cfabf to
7550220
Compare
|
@mcollina I've updated the PR so that the classes that inherit However, |
|
Should I give up and close this one? |
ef314da to
d322bc4
Compare
|
not sure, should this be the amount sent to |
|
I think we are computing it in the right moment. Bytes written to the stream, not bytes flushed out. |
|
@mcollina: What is left here in order to make this mergable? |
|
Unit tests. I’m also unsure about the naming. |
Ok.
Yes I was unsure about this myself. What about just |
d322bc4 to
86ee44a
Compare
|
I would go for writableWritten, even if it sounds bad: written might be too generic and conflict with some other properties. |
86ee44a to
dccba4d
Compare
|
Tests added |
13157ec to
ed38fa8
Compare
|
@mcollina I’d really prefer to keep consistency with the existing properties that provide this information, which are called |
|
I think we should document and test the behavior of these properties with objectMode: true. |
|
I kind of agree with @addaleax about names. |
ed38fa8 to
499c736
Compare
|
Rebased, cleaned up and fixed test. What's the consensus in regards to:
|
0f6a4e8 to
3b07f24
Compare
|
This might need a semver-major. We already have |
3b07f24 to
4a01aa8
Compare
|
|
||
| Integer value that indicates how many bytes has been written to | ||
| the response body (not the amount flushed). | ||
|
|
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 we even need this here since WriteStream inherits from Writable which now documents this property? Remove?
| } | ||
| return cb(er); | ||
| } | ||
| this.bytesWritten += bytes; |
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.
notice that WriteStream increments bytesWritten inside _write() callback and not in write(). I think this is actually wrong and slightly contradicts the previous documentation as well (and possibly expected behaviour, it surprised me).
| self.destroy(); | ||
| return cb(er); | ||
| } | ||
| self.bytesWritten += bytes; |
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.
See comment above.
|
I'm closing this for now. |
Adds
bytesWrittenhelper to http/1 & compat response.Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passes