Skip to content

Commit

Permalink
Minor change and documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolas-van committed Nov 3, 2021
1 parent 72bb45b commit 6e3e845
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
5 changes: 3 additions & 2 deletions src/filterGenerator.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ import asyncWrap from './asyncWrap.mjs'
/**
* Produces a an async iterator that will return each value or `iterable` which pass an asynchronous truth test.
*
* The iterator will try to consume as fast as possible the values from `iterable` and will performs the call
* to `iteratee` in a queue. This allows to limit the concurrency of the calls to `iteratee`.
* The iterator will perform the calls to `iteratee` in a queue. This allows to limit the concurrency of
* the calls to `iteratee`. The iterator will consume values from `iterable` only if slots are available in the
* queue.
*
* If the returned iterator is not fully consumed it will stop consuming new values from `iterable` and scheduling
* new calls to `iteratee` in the queue, but already scheduled tasks will still be executed.
Expand Down
7 changes: 4 additions & 3 deletions src/mapGenerator.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ import Queue from './Queue.mjs'
* Produces a an async iterator that will return each value or `iterable` after having processed them through
* the `iteratee` function.
*
* The iterator will try to consume as fast as possible the values from `iterable` and will performs the call
* to `iteratee` in a queue. This allows to limit the concurrency of the calls to `iteratee`.
* The iterator will perform the calls to `iteratee` in a queue. This allows to limit the concurrency of
* the calls to `iteratee`. The iterator will consume values from `iterable` only if slots are available in the
* queue.
*
* If the returned iterator is not fully consumed it will stop consuming new values from `iterable` and scheduling
* new calls to `iteratee` in the queue, but already scheduled tasks will still be executed.
Expand Down Expand Up @@ -178,7 +179,7 @@ async function * mapGenerator (iterable, iteratee, concurrencyOrQueue = 1, order
hasFetchedValue = false
fetchedValue = null
}
if (!fetching && !exhausted && !shouldStop && scheduledCount <= queue.concurrency + 1) {
if (!fetching && !exhausted && !shouldStop && scheduledCount <= queue.concurrency) {
fetch()
}
}
Expand Down

0 comments on commit 6e3e845

Please sign in to comment.