Skip to content

Commit 889969f

Browse files
committed
Merge branch 'release/6.1.0'
2 parents 71f4bb6 + 8365fea commit 889969f

File tree

3 files changed

+14
-4
lines changed

3 files changed

+14
-4
lines changed

.github/workflows/ci.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
fail-fast: false
1010
matrix:
1111
os: [ubuntu-latest, macos-latest, windows-latest]
12-
node-version: [12.x, 13.x, 14.x, 15.x]
12+
node-version: [10.x, 11.x, 12.x, 13.x, 14.x, 15.x]
1313
runs-on: ${{matrix.os}}
1414
steps:
1515
- uses: actions/checkout@v2

index.js

+12-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,17 @@
11
const { resolve } = require('path')
2-
const WorkerPool = require('piscina')
2+
const NODE_MAJOR_VERSION = process.versions.node.split('.')[0]
3+
let pool = null
34

4-
const pool = new WorkerPool({ filename: resolve(__dirname, 'worker.js') })
5+
if (NODE_MAJOR_VERSION < 12) {
6+
console.warn('[camaro] worker_threads is not available, expect performance drop. Try using Node version >= 12.')
7+
const workerFn = require('./worker')
8+
pool = {
9+
runTask: async (args) => workerFn(args)
10+
}
11+
} else {
12+
const WorkerPool = require('piscina')
13+
pool = new WorkerPool({ filename: resolve(__dirname, 'worker.js') })
14+
}
515

616
function isNonEmptyString(str) {
717
return typeof str === 'string' && str.length > 0

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,6 @@
6363
"tape": "^5.0.1"
6464
},
6565
"dependencies": {
66-
"piscina": "^1.6.3"
66+
"piscina": "^2.1.0"
6767
}
6868
}

0 commit comments

Comments
 (0)