From: Jérôme Benoit Date: Fri, 30 Aug 2024 18:49:02 +0000 (+0200) Subject: docs: code cleanup in examples X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=24bc951b90abfe7a365ef6323888d51fde479552;p=poolifier.git docs: code cleanup in examples Signed-off-by: Jérôme Benoit --- diff --git a/examples/typescript/http-client-pool/src/main.ts b/examples/typescript/http-client-pool/src/main.ts index 9848d21f..13cfd0e2 100644 --- a/examples/typescript/http-client-pool/src/main.ts +++ b/examples/typescript/http-client-pool/src/main.ts @@ -20,9 +20,7 @@ for (const workerFunction of ['node_fetch', 'fetch', 'axios']) { ) const elapsedTime = performance.now() - now console.info( - `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`, + `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) { diff --git a/examples/typescript/smtp-client-pool/src/main.ts b/examples/typescript/smtp-client-pool/src/main.ts index a06a800c..ceea27a4 100644 --- a/examples/typescript/smtp-client-pool/src/main.ts +++ b/examples/typescript/smtp-client-pool/src/main.ts @@ -28,12 +28,11 @@ for (const to of tos) { try { const now = performance.now() - await smtpClientPool.mapExecute(smtpMessages) + const responses = await smtpClientPool.mapExecute(smtpMessages) const elapsedTime = performance.now() - now console.info( - `Send in parallel in ${elapsedTime.toFixed( - 2 - )}ms ${tos.length.toString()} mails with SMTP client pool` + `Send in parallel in ${elapsedTime.toFixed(2)}ms ${tos.length.toString()} mails with SMTP client pool:\n`, + responses ) } catch (error) { console.error(error)