X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=examples%2Ftypescript%2Fhttp-client-pool%2Fsrc%2Fmain.ts;h=696671eaeb8e0e81b7b27ee1119704b289e2afd2;hb=HEAD;hp=f307bb622ca7e5dbe549be2fffe33991e0caa547;hpb=c97a785f1274883c88a77d2bf418ba6480d20d04;p=poolifier.git diff --git a/examples/typescript/http-client-pool/src/main.ts b/examples/typescript/http-client-pool/src/main.ts index f307bb62..696671ea 100644 --- a/examples/typescript/http-client-pool/src/main.ts +++ b/examples/typescript/http-client-pool/src/main.ts @@ -1,6 +1,7 @@ import { availableParallelism } from 'poolifier' + import { httpClientPool } from './pool.js' -import { type WorkerResponse } from './types.js' +import type { WorkerResponse } from './types.js' const parallelism = availableParallelism() * 2 const requestUrl = 'http://localhost:8080/' @@ -17,9 +18,9 @@ for (const workerFunction of ['node_fetch', 'fetch', 'axios']) { const responses = await Promise.all(httpClientPoolPromises) const elapsedTime = performance.now() - now console.info( - `Received in ${elapsedTime.toFixed(2)}ms an array with ${ - responses.length - } responses from ${parallelism} parallel requests made with ${workerFunction} on ${requestUrl}:\n`, + `Received in ${elapsedTime.toFixed( + 2 + )}ms an array with ${responses.length.toString()} responses from ${parallelism.toString()} parallel requests made with HTTP client pool task function ${workerFunction} on ${requestUrl}:\n`, responses ) } catch (error) {