|
@ -23,7 +23,9 @@ const configure = (socket) => { |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let processed = 0; |
|
|
|
|
|
let limit = 10000; |
|
|
|
|
|
|
|
|
// Create a new listener for the parse start event
|
|
|
// Create a new listener for the parse start event
|
|
|
emitter.on('parse.start', ({ filepath, columns, headers, result }) => { |
|
|
emitter.on('parse.start', ({ filepath, columns, headers, result }) => { |
|
@ -32,13 +34,24 @@ const configure = (socket) => { |
|
|
|
|
|
|
|
|
// Create a new listener for the parse.end event
|
|
|
// Create a new listener for the parse.end event
|
|
|
emitter.on('parse.end', ({ filepath, columns, count }) => { |
|
|
emitter.on('parse.end', ({ filepath, columns, count }) => { |
|
|
|
|
|
processed = 0; |
|
|
socket.emit('parse.end', { message: 'Traitement terminé' }); |
|
|
socket.emit('parse.end', { message: 'Traitement terminé' }); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
// Create a new listener for the parse.error event
|
|
|
// Create a new listener for the parse.error event
|
|
|
emitter.on('parse.error', ({ filepath, columns, error }) => { |
|
|
emitter.on('parse.error', ({ filepath, columns, error }) => { |
|
|
|
|
|
processed = 0; |
|
|
socket.emit('parse.error', { message: 'Erreur lors du traitement' }); |
|
|
socket.emit('parse.error', { message: 'Erreur lors du traitement' }); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
emitter.on('parse.data', ({ filepath, columns, data, index }) => { |
|
|
|
|
|
processed++; |
|
|
|
|
|
|
|
|
|
|
|
if ( processed == limit ) { |
|
|
|
|
|
socket.emit('parse.data', { message: `[${index} lignes] traités` }); |
|
|
|
|
|
processed = 0; |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
module.exports = configure; |
|
|
module.exports = configure; |