]> git.ardis.lu - csvio/commitdiff
Use "concurrent" instead of "parallel" to avoid confusion with threads
authorArdis Lu <ardisglu@gmail.com>
Mon, 20 Jan 2025 07:26:04 +0000 (23:26 -0800)
committerArdis Lu <ardisglu@gmail.com>
Mon, 20 Jan 2025 07:26:04 +0000 (23:26 -0800)
examples/ex8.js

index a44f6be515793c811360d86ddf5c545960ede48a..f6b0e698f1a559109ad04f50436a38484a388b3c 100644 (file)
@@ -1,6 +1,6 @@
 // ## Example 8: Processing rows concurrently (async)
 // 
-// Set the `maxConcurrent` option to a number greater than `1` to process rows in parallel. The transformation function
+// Set the `maxConcurrent` option to a number greater than `1` to process rows concurrently. The transformation function
 // will be automatically turned into a promise if it isn't already async.
 // 
 // Note that execution is blocked until all promises in a concurrent group settle. So if there is one transformation that
@@ -18,7 +18,7 @@ function tick() {
 }
 
 let firstChunk = true;
-async function parallel(row) {
+async function concurrent(row) {
   if (firstChunk) {
     firstChunk = false;
     return ['tick number', ...row];
@@ -28,5 +28,5 @@ async function parallel(row) {
 }
 
 await new CSVReader(new URL('./data/ex8-in.csv', import.meta.url))
-  .pipeThrough(new CSVTransformer(parallel, { includeHeaders: true, maxConcurrent: 5 }))
+  .pipeThrough(new CSVTransformer(concurrent, { includeHeaders: true, maxConcurrent: 5 }))
   .pipeTo(new CSVWriter(new URL('./data/ex8-out.csv', import.meta.url)));
\ No newline at end of file
This page took 0.041145 seconds and 4 git commands to generate.