From bf0ea1dfe014823b16d0fdc111d0a1f67e215f6e Mon Sep 17 00:00:00 2001 From: Conner McNamara <1103780+cdm6a@users.noreply.github.com> Date: Wed, 13 Mar 2024 11:00:51 -0700 Subject: [PATCH] Add the ability to disable the worker pool --- index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index 44797d7..b117575 100644 --- a/index.js +++ b/index.js @@ -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 = { @@ -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',