Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3399508
D9301.id31448.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D9301.id31448.diff
View Options
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
Details
Attached
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)
Attached To
Mode
D9301: [keyserver] Add `$KEYSERVER_PROFILING_ENABLED` to toggle `node:cluster`
Attached
Detach File
Event Timeline
Log In to Comment