From 70c7d1fde052b84dedbc5d644f973bdabd652747 Mon Sep 17 00:00:00 2001 From: JaeHyeok Kim Date: Fri, 17 Mar 2023 02:39:15 +0900 Subject: [PATCH] Revert "Fix use the physical CPU count from NestJS (#7987)" This reverts commit e0fa21156973165d78e791049e5a8a71155cb901. --- frameworks/TypeScript/nest/package.json | 1 - frameworks/TypeScript/nest/src/main.ts | 5 +++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/frameworks/TypeScript/nest/package.json b/frameworks/TypeScript/nest/package.json index 96d95bdce9b..219569e19e4 100644 --- a/frameworks/TypeScript/nest/package.json +++ b/frameworks/TypeScript/nest/package.json @@ -28,7 +28,6 @@ "mongodb": "3.5.4", "mysql2": "2.1.0", "pg": "8.5.1", - "physical-cpu-count": "^2.0.0", "point-of-view": "3.7.2", "reflect-metadata": "0.1.13", "rimraf": "3.0.2", diff --git a/frameworks/TypeScript/nest/src/main.ts b/frameworks/TypeScript/nest/src/main.ts index 67675f3f763..82fa61ea07d 100644 --- a/frameworks/TypeScript/nest/src/main.ts +++ b/frameworks/TypeScript/nest/src/main.ts @@ -9,7 +9,7 @@ import { MongoModule } from './mongo/mongo.module'; import { join } from 'path'; import { SqlModule } from './sql/sql.module'; import cluster from 'cluster' -import physicalCpuCount from 'physical-cpu-count'; +import os = require('os'); const port = process.env.PORT || 8080; @@ -58,7 +58,8 @@ async function bootstrapFastify() { } if (cluster.isPrimary) { - for (let i = 0; i < physicalCpuCount; i++) { + const cpus = os.cpus().length; + for (let i = 0; i < cpus; i++) { cluster.fork(); }