From 1421af2bb2a0d3f6cf676c00890221d5312f84ce Mon Sep 17 00:00:00 2001 From: Onja Date: Tue, 17 Oct 2023 17:14:32 +0300 Subject: [PATCH] Add logic to count the number of processed lines and log the count when it reaches the specified limit in the 'parse.data' event listener --- src/subscribers/consoleSubscriber.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/subscribers/consoleSubscriber.js b/src/subscribers/consoleSubscriber.js index 76a281b..b534337 100644 --- a/src/subscribers/consoleSubscriber.js +++ b/src/subscribers/consoleSubscriber.js @@ -78,6 +78,16 @@ emitter.on('parse.error', ({ filepath, columns, error }) => { // emitter.on('parse.data', ({ filepath, columns, data, index }) => { // log('parse.data', `Parsed ${filepath} with columns at index ${index}`); // }); +let processed = 0; +let limit = 10000; +emitter.on('parse.data', ({ filepath, columns, data, index }) => { + processed++; + + if ( processed == limit ) { + log('parse.data', `[${index.toLocaleString()} lignes] traités`); + processed = 0; + } +}); // Create a new listener for the deleteOldFiles.start event