Page MenuHomePhabricator

D9301.id31448.diff
No OneTemporary

D9301.id31448.diff

diff --git a/keyserver/src/keyserver.js b/keyserver/src/keyserver.js
--- a/keyserver/src/keyserver.js
+++ b/keyserver/src/keyserver.js
@@ -60,7 +60,9 @@
? undefined
: { maxAge: '1y', immutable: true };
- if (cluster.isMaster) {
+ const isCPUProfilingEnabled = process.env.KEYSERVER_CPU_PROFILING_ENABLED;
+
+ if (cluster.isMaster || isCPUProfilingEnabled) {
const didMigrationsSucceed: boolean = await migrate();
if (!didMigrationsSucceed) {
// The following line uses exit code 2 to ensure nodemon exits
@@ -103,12 +105,16 @@
}
}
- const cpuCount = os.cpus().length;
- for (let i = 0; i < cpuCount; i++) {
- cluster.fork();
+ if (!isCPUProfilingEnabled) {
+ const cpuCount = os.cpus().length;
+ for (let i = 0; i < cpuCount; i++) {
+ cluster.fork();
+ }
+ cluster.on('exit', () => cluster.fork());
}
- cluster.on('exit', () => cluster.fork());
- } else {
+ }
+
+ if (!cluster.isMaster || isCPUProfilingEnabled) {
const server = express();
expressWs(server);
server.use(express.json({ limit: '250mb' }));

File Metadata

Mime Type
text/plain
Expires
Tue, Dec 3, 3:28 AM (19 h, 34 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2610057
Default Alt Text
D9301.id31448.diff (1 KB)

Event Timeline