This is a working example to limit the concurrency of requests.
Using eth-fun without any concurrency can choke the RPC endpoint.
This example uses the p-limit library to limit concurrency.
const pool = pLimit(concurrency);
const promises = [];
for (let i = 0; i < totalRequests; i++) {
promises.push(pool(() => blockNumber(options)));
}
Wrapping eth-fun functions in pool
ensures at most n number of calls are made. You can see the difference in elapsed time as you change the concurrency.
$ npm install
$ npm run start