Skip to content

Commit

Permalink
Merge branch 'release/6.1.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
tuananh committed Jan 31, 2021
2 parents 71f4bb6 + 8365fea commit 889969f
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
node-version: [12.x, 13.x, 14.x, 15.x]
node-version: [10.x, 11.x, 12.x, 13.x, 14.x, 15.x]
runs-on: ${{matrix.os}}
steps:
- uses: actions/checkout@v2
Expand Down
14 changes: 12 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
const { resolve } = require('path')
const WorkerPool = require('piscina')
const NODE_MAJOR_VERSION = process.versions.node.split('.')[0]
let pool = null

const pool = new WorkerPool({ filename: resolve(__dirname, 'worker.js') })
if (NODE_MAJOR_VERSION < 12) {
console.warn('[camaro] worker_threads is not available, expect performance drop. Try using Node version >= 12.')
const workerFn = require('./worker')
pool = {
runTask: async (args) => workerFn(args)
}
} else {
const WorkerPool = require('piscina')
pool = new WorkerPool({ filename: resolve(__dirname, 'worker.js') })
}

function isNonEmptyString(str) {
return typeof str === 'string' && str.length > 0
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,6 @@
"tape": "^5.0.1"
},
"dependencies": {
"piscina": "^1.6.3"
"piscina": "^2.1.0"
}
}

0 comments on commit 889969f

Please sign in to comment.