Skip to content

Commit

Permalink
Merge pull request #141 from cdm6a/add-destory
Browse files Browse the repository at this point in the history
Add destroy method for graceful shutdown of worker pool
  • Loading branch information
tuananh committed Dec 11, 2023
2 parents 69bd9db + 1a87dce commit f4f260c
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,13 @@ function prettyPrint(xml, opts = { indentSize: 2 }) {
return pool.run({ fn: 'prettyPrint', args: [xml, opts] })
}

module.exports = { transform, toJson, prettyPrint }
/**
* destroy the worker pool
*/
function destroy() {
if (pool && typeof pool.destroy === 'function') {
return pool.destroy();
}
}

module.exports = { transform, toJson, prettyPrint, destroy }

0 comments on commit f4f260c

Please sign in to comment.