Browse Source

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

node10
Onja 11 months ago
parent
commit
1421af2bb2
  1. 10
      src/subscribers/consoleSubscriber.js

10
src/subscribers/consoleSubscriber.js

@ -78,6 +78,16 @@ emitter.on('parse.error', ({ filepath, columns, error }) => {
// emitter.on('parse.data', ({ filepath, columns, data, index }) => { // emitter.on('parse.data', ({ filepath, columns, data, index }) => {
// log('parse.data', `Parsed ${filepath} with columns at index ${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 // Create a new listener for the deleteOldFiles.start event

Loading…
Cancel
Save