Allows the number of requests allowed in a pool to vary over time by
retrieving the current pool size from a callback instead of a single
constant number.
This allows us to amend the number of requests ongoing according to our
needs, e.g. by responding to rate limiting information provided by an
upstream API.
Changes are
* Allow a callback to be passed in to specify the pool size instead of a
constant pool size.
* As each request returns, add enough new requests to the queue to fill
up to the current pool size limit.
When requests are intercepted in a Pool, it can result in infinite
recursion. This commit modifies the Pool to inspect the promise type of
a request to see if it was completed or not. If the request is completed
after sending, then we wait on the request to emit any pending events
and use `goto` to send the next request and prevent the stack from
growing.
Closes#905.
Adding tests.
Not emitting multiple "end" events when redirecting.
Moving wrapException to a public function.
Fixing Pool so that it works with completed mocked futures.
Added a BatchResults class.