| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
|
Review requested:
|
Sorry, something went wrong.
| if (options?.destroyStream != null) { | ||
| validateBoolean(options.destroyStream, 'options.destroyStream'); | ||
| } |
There was a problem hiding this comment.
Maybe another name would be better? Not sure what though... @benjamingr
Sorry, something went wrong.
| for await (const val of this.iterator({ destroyOnReturn: options?.destroyStream ?? true })) { | ||
| if (options?.signal?.aborted) { | ||
| throw new AbortError(); | ||
| } |
There was a problem hiding this comment.
I think that if the stream fails we should close the stream, WDYT @ronag ?
Sorry, something went wrong.
There was a problem hiding this comment.
@mcollina any thoughts on your side?
Sorry, something went wrong.
There was a problem hiding this comment.
after thinking I think it should be closed on an error as in the iterator helpers proposal spec the underlying iterator should be closed when it failed
Sorry, something went wrong.
There was a problem hiding this comment.
Thanks for opening a PR! Can you please add a unit test?
Sorry, something went wrong.
|
Docs are also missing |
Sorry, something went wrong.
|
Hey @mcollina I've added tests and docs :) |
Sorry, something went wrong.
There was a problem hiding this comment.
lgtm
Sorry, something went wrong.
|
@mcollina is something holding this back from merging? Or we waiting for the TC39? |
Sorry, something went wrong.
|
we have 48 hours grace period to allow for folks across the globe to review |
Sorry, something went wrong.
Failed to start CI- Validating Jenkins credentials ✔ Jenkins credentials valid - Starting PR CI job ✘ Failed to start PR CI: 403 Forbiddenhttps://github.com/nodejs/node/actions/runs/4384604326 |
Sorry, something went wrong.
Sorry, something went wrong.
Co-authored-by: Debadree Chatterjee <debadree333@gmail.com>
…fter-take-46980' into feat/allow_stream-to-stay-open-after-take-46980
There was a problem hiding this comment.
I think you would need to remove the merge commit since supposedly it can cause issues with the tooling everything else is good!!
Sorry, something went wrong.
aren't we using squash and merge? |
Sorry, something went wrong.
Ref: #46910 (comment) |
Sorry, something went wrong.
There was a problem hiding this comment.
I don't think discussion has exhausted itself in the spec issue and I don't want to deviate from it until we proved we must
Sorry, something went wrong.
Should be add the blocked label for now then? |
Sorry, something went wrong.
There was a problem hiding this comment.
Yeah sorry I meant to explicitly block and hit the wrong button
Sorry, something went wrong.
There was a problem hiding this comment.
I think what you really want is a chunk (which will be proposed for inclusion in standard iterators in the future) or a nextN helper like
function nextN(iterator, n) {
const result = [];
const next = iterator.next;
for (; n > 0; --n) {
cont { done, value } = next.call(iterator);
if (done) break;
result.push(value);
}
return result;
}
Sorry, something went wrong.
|
@michaelficarra no problem but maybe could you update the proposal first so we won't have this back and forth FYI I think nextN is better name than chunk |
Sorry, something went wrong.
|
@rluvaton chunk is a different method than the nextN that I wrote. See tc39/proposal-iterator-helpers#71 (comment) or https://www.npmjs.com/package/chunk. |
Sorry, something went wrong.
Oh, after looking at chunk what I really want is nextN which is basically a non-closing take Do you think that non-closing take will be added? chunk is less what I want as:
|
Sorry, something went wrong.
|
Having nextN as an operator that returns iterable would enable:
Example of usages: having it as an operator: const responses = await topVisitedUrlsIterator
.filter(noEmptyLine)
.drop(1) // Header
.nextN(8)
.map(parseLine)
.map(value => apiCall(value), { concurrency: 4 })
.toArray();having it as a static function: const values = await nextN(
topVisitedUrlsIterator
.filter(noEmptyLine)
.drop(1),
8)
.map(parseLine);
// How would I use the concurrency that we would have in the map?
const responses = concurrentMap(values, (value) => apiCall(value), 4); |
Sorry, something went wrong.
# Conflicts: # lib/internal/streams/operators.js
Sorry, something went wrong.
|
This pull request has been marked as stale due to 90 days of inactivity. |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
fix #46980
TODO