fixup: make cluster limit into a per-mode warning rather than error
Some checks failed
ci/woodpecker/push/lint-foundkey-js Pipeline was successful
ci/woodpecker/push/lint-client Pipeline was successful
ci/woodpecker/push/lint-backend Pipeline was successful
ci/woodpecker/push/build Pipeline was successful
ci/woodpecker/push/test Pipeline was successful
ci/woodpecker/pr/lint-foundkey-js Pipeline was successful
ci/woodpecker/pr/lint-backend Pipeline failed
ci/woodpecker/pr/build Pipeline was successful
ci/woodpecker/pr/lint-client Pipeline failed
ci/woodpecker/pr/test Pipeline failed
Some checks failed
ci/woodpecker/push/lint-foundkey-js Pipeline was successful
ci/woodpecker/push/lint-client Pipeline was successful
ci/woodpecker/push/lint-backend Pipeline was successful
ci/woodpecker/push/build Pipeline was successful
ci/woodpecker/push/test Pipeline was successful
ci/woodpecker/pr/lint-foundkey-js Pipeline was successful
ci/woodpecker/pr/lint-backend Pipeline failed
ci/woodpecker/pr/build Pipeline was successful
ci/woodpecker/pr/lint-client Pipeline failed
ci/woodpecker/pr/test Pipeline failed
This commit is contained in:
parent
48a60b03ea
commit
6600f6e52e
1 changed files with 4 additions and 4 deletions
|
@ -141,12 +141,12 @@ async function connectDb(): Promise<void> {
|
||||||
|
|
||||||
async function spawnWorkers(clusterLimits: Required<Config['clusterLimits']>): Promise<void> {
|
async function spawnWorkers(clusterLimits: Required<Config['clusterLimits']>): Promise<void> {
|
||||||
const modes = ['web', 'queue'];
|
const modes = ['web', 'queue'];
|
||||||
const total = modes.reduce((acc, mode) => acc + clusterLimits[mode], 0);
|
const cpus = os.cpus().length;
|
||||||
if (total > os.cpus().length) {
|
for (const mode of modes.filter(mode => clusterLimits[mode] > cpus)) {
|
||||||
bootLogger.error(`configuration error: cluster limits total (${total}) must not exceed number of cores (${os.cpus().length})`);
|
bootLogger.warn(`configuration warning: cluster limit for ${mode} exceeds number of cores (${cpus})`);
|
||||||
process.exit(78);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const total = modes.reduce((acc, mode) => acc + clusterLimits[mode], 0);
|
||||||
const workers = new Array(total);
|
const workers = new Array(total);
|
||||||
workers.fill('web', 0, clusterLimits.web);
|
workers.fill('web', 0, clusterLimits.web);
|
||||||
workers.fill('queue', clusterLimits.web);
|
workers.fill('queue', clusterLimits.web);
|
||||||
|
|
Loading…
Reference in a new issue