Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: separated forced transpilation from --multiprocess #22301

Merged
merged 2 commits into from
Apr 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 10 additions & 4 deletions build/transpile.js
Original file line number Diff line number Diff line change
Expand Up @@ -2937,15 +2937,21 @@ class Transpiler {
}
}

function parallelizeTranspiling (exchanges, processes = undefined) {
function parallelizeTranspiling (exchanges, processes = undefined, force = false) {
const processesNum = Math.min(processes || os.cpus ().length, exchanges.length)
log.bright.green ('starting ' + processesNum + ' new processes...')
let isFirst = true
const args = [];
if (force) {
args.push ('--force')
}
for (let i = 0; i < processesNum; i ++) {
const toProcess = exchanges.filter ((_, index) => index % processesNum === i)
const args = isFirst ? [ '--force' ] : [ '--child', '--force' ]
isFirst = false
fork (process.argv[1], toProcess.concat (args))
if (isFirst) {
args.push ('--child');
isFirst = false
}
}
}

Expand Down Expand Up @@ -2980,7 +2986,7 @@ if (isMainEntry(import.meta.url)) {
} else if (errors) {
transpiler.transpileErrorHierarchy ({ tsFilename })
} else if (multiprocess) {
parallelizeTranspiling (exchangeIds)
parallelizeTranspiling (exchangeIds, undefined, force)
} else {
(async () => {
await transpiler.transpileEverything (force, child)
Expand Down
2 changes: 1 addition & 1 deletion build/transpileWS.js
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ if (isMainEntry(import.meta.url)) { // called directly like `node module`
transpiler.transpileWsTests ()
}
else if (multiprocess) {
parallelizeTranspiling (exchanges.ws)
parallelizeTranspiling (exchanges.ws, undefined, force)
} else {
(async () => {
await transpiler.transpileEverything (force, child)
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,9 @@
"force-transpile-fast": "npm run dev-force-transpile",
"dev-force-transpile": "npm run fast-force-transpileRest && npm run fast-force-transpileWs",
"force-transpileRest": "node build/transpile --force",
"fast-force-transpileRest": "node build/transpile.js --multiprocess",
"fast-force-transpileRest": "node build/transpile.js --multiprocess --force",
"force-transpileWs": "node build/transpileWS --force",
"fast-force-transpileWs": "node build/transpileWS.js --multiprocess",
"fast-force-transpileWs": "node build/transpileWS.js --multiprocess --force",
"test-js-cache": "node js/src/pro/test/base/test.Cache.js",
"test-js-orderbook": "node js/src/pro/test/base/test.OrderBook.js",
"test-python-cache": "python python/ccxt/pro/test/base/test_cache.py",
Expand Down