stream: abort signal in readable streams#36061
stream: abort signal in readable streams#36061benjamingr wants to merge 1 commit intonodejs:masterfrom
Conversation
|
Review requested:
|
|
Idea from Matteo:
Question: what if someone sets it multiple times does it unsubscribe from previous calls? Maybe a static helper for setting an abort signal? |
|
I think it’s better without setter. |
|
@ronag talking to Matteo on FB: I think it's probably better to have a static |
|
Naming suggestions welcome, also ccing @bterlson regarding naming suggestions or opinions here |
|
I've prototyped an alternative approach using a static method here: 6a92d8c - I think the DX is slightly better though still not great? |
6a92d8c to
52d3dd6
Compare
doc/api/stream.md
Outdated
There was a problem hiding this comment.
An example that shows this used with an async iterator would be good.
There was a problem hiding this comment.
A test that sets up a pipeline that uses AbortController would be good, as would a test using a single AbortController for two different Readables at the same time.
There was a problem hiding this comment.
Please add tests for writable as well.
|
@mcollina I've changed the API to work with Readable and Writeable and not just Readable and added a test for that as well. @jasnell added a test for @ronag I'll add the signal as a constructor argument to PTAL :] |
There was a problem hiding this comment.
this should not be called readable.
There was a problem hiding this comment.
I don't think this works as you think it would. I think this passes for every descendant of Stream.
There was a problem hiding this comment.
I think so too and so do the tests - but I just copied isReadable from pipeline
Why not in same PR? |
There is already a lot of discussion happening here and I don't feel like making more changes here would make our lives easier basically. |
4b21891 to
04cf1c7
Compare
Commit Queue failed- Loading data for nodejs/node/pull/36061 ✔ Done loading data for nodejs/node/pull/36061 ----------------------------------- PR info ------------------------------------ Title stream: abort signal in readable streams (#36061) ⚠ Could not retrieve the email or name of the PR author's from user's GitHub profile! Branch benjamingr:abort-signal-stream -> nodejs:master Labels dont-land-on-v10.x, dont-land-on-v12.x, dont-land-on-v14.x, semver-minor, stream Commits 1 - stream: support abort signal Committers 1 - Benjamin Gruenbaum PR-URL: https://github.com/nodejs/node/pull/36061 Reviewed-By: Matteo Collina Reviewed-By: Robert Nagy ------------------------------ Generated metadata ------------------------------ PR-URL: https://github.com/nodejs/node/pull/36061 Reviewed-By: Matteo Collina Reviewed-By: Robert Nagy -------------------------------------------------------------------------------- ⚠ Commits were pushed since the last review: ⚠ - stream: support abort signal ✔ Last GitHub Actions successful ℹ Last Full PR CI on 2020-12-07T13:08:26Z: https://ci.nodejs.org/job/node-test-pull-request/34817/ - Querying data for job/node-test-pull-request/34817/ ✔ Build data downloaded ✔ Last Jenkins CI successful ℹ This PR was created on Tue, 10 Nov 2020 08:54:00 GMT ✔ Approvals: 2 ✔ - Matteo Collina (@mcollina) (TSC): https://github.com/nodejs/node/pull/36061#pullrequestreview-544382792 ✔ - Robert Nagy (@ronag): https://github.com/nodejs/node/pull/36061#pullrequestreview-545601618 -------------------------------------------------------------------------------- ✔ Aborted `git node land` session in /home/runner/work/node/node/.ncuhttps://github.com/nodejs/node/actions/runs/406052944 |
|
@mcollina can you LGTM after the last rebase so I can land with the commit queue? I'm hesitant to land with ncu locally if I can help it :] |
|
Landed in 5122456...5bd1eec |
PR-URL: #36061 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Robert Nagy <[email protected]>
|
Next up, the constructor arg version. |
PR-URL: #36061 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Robert Nagy <[email protected]>
PR-URL: #36435 Notable changes: * child_processes: * add AbortSignal support (Benjamin Gruenbaum) (#36308) * deps: * update ICU to 68.1 (Michaël Zasso) (#36187) * events: * support signal in EventTarget (Benjamin Gruenbaum) (#36258) * graduate Event, EventTarget, AbortController (James M Snell) (#35949) * http: * enable call chaining with setHeader() (pooja d.p) (#35924) * module: * add isPreloading indicator (James M Snell) (#36263) * stream: * support abort signal (Benjamin Gruenbaum) (#36061) * add FileHandle support to Read/WriteStream (Momtchil Momtchev) (#35922) * worker: * add experimental BroadcastChannel (James M Snell) (#36271)
PR-URL: nodejs#36061 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Robert Nagy <[email protected]>
PR-URL: #36435 Notable changes: * child_processes: * add AbortSignal support (Benjamin Gruenbaum) (#36308) * deps: * update ICU to 68.1 (Michaël Zasso) (#36187) * events: * support signal in EventTarget (Benjamin Gruenbaum) (#36258) * graduate Event, EventTarget, AbortController (James M Snell) (#35949) * http: * enable call chaining with setHeader() (pooja d.p) (#35924) * module: * add isPreloading indicator (James M Snell) (#36263) * stream: * support abort signal (Benjamin Gruenbaum) (#36061) * add FileHandle support to Read/WriteStream (Momtchil Momtchev) (#35922) * worker: * add experimental BroadcastChannel (James M Snell) (#36271)
PR-URL: #36435 Notable changes: * child_processes: * add AbortSignal support (Benjamin Gruenbaum) (#36308) * deps: * update ICU to 68.1 (Michaël Zasso) (#36187) * events: * support signal in EventTarget (Benjamin Gruenbaum) (#36258) * graduate Event, EventTarget, AbortController (James M Snell) (#35949) * http: * enable call chaining with setHeader() (pooja d.p) (#35924) * module: * add isPreloading indicator (James M Snell) (#36263) * stream: * support abort signal (Benjamin Gruenbaum) (#36061) * add FileHandle support to Read/WriteStream (Momtchil Momtchev) (#35922) * worker: * add experimental BroadcastChannel (James M Snell) (#36271)
Mostly opened for discussion about semantics.
Are these semantics correct? Do they make sense?
This is WIP: I want to test this thoroughly before considering merging + docs need to be updated.
Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passes