Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions papaparse.js
Original file line number Diff line number Diff line change
Expand Up @@ -1866,24 +1866,25 @@ License: MIT
if (aborted)
break;
}
delete msg.results; // free memory ASAP
}
else if (isFunction(worker.userChunk))
{
worker.userChunk(msg.results, handle, msg.file);
delete msg.results;
}
}

if (msg.finished && !aborted)
completeWorker(msg.workerId, msg.results);
completeWorker(msg.workerId, msg.results, msg.file);

delete msg.results;
}

function completeWorker(workerId, results) {
function completeWorker(workerId, results, file) {
var worker = workers[workerId];
if (isFunction(worker.userComplete))
worker.userComplete(results);
worker.terminate();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you elaborate why wee need to terminate the worker only when a function is defined?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I may have unintentionally changed the original flow while modifying the code. I'll revert back to. Thank you.

if (isFunction(worker.userComplete)) {
worker.userComplete(results, file);
worker.terminate();
}
delete workers[workerId];
}

Expand Down