Skip to content

Commit

Permalink
Merge pull request #146 from cdm6a/single-threaded
Browse files Browse the repository at this point in the history
Add the ability to disable the worker pool
  • Loading branch information
tuananh authored Mar 14, 2024
2 parents 2bcde9a + bf0ea1d commit 45aa53c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const { resolve } = require('path')
const NODE_MAJOR_VERSION = process.versions.node.split('.')[0]
let pool = null

if (NODE_MAJOR_VERSION < 12) {
if (NODE_MAJOR_VERSION < 12 || process.env.CAMARO_FORCE_SINGLE_THREAD === 'true') {
console.warn('[camaro] worker_threads is not available, expect performance drop. Try using Node version >= 12.')
const workerFn = require('./worker')
pool = {
Expand Down Expand Up @@ -34,7 +34,7 @@ function transform(xml, template) {

if (!template || typeof template !== 'object' || isEmptyObject(template)) {
throw new TypeError('2nd argument (template) must be an object')
}
}

return pool.run({
fn: 'transform',
Expand Down

0 comments on commit 45aa53c

Please sign in to comment.