Skip to content

Commit

Permalink
Merge pull request #308 from yamadashy/feat/website-log
Browse files Browse the repository at this point in the history
feat(website): Log the number of servers in parallel
  • Loading branch information
yamadashy authored Jan 25, 2025
2 parents 745df97 + 90c39fe commit 5c466e1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
4 changes: 4 additions & 0 deletions website/server/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ import { timeout } from 'hono/timeout';
import { processRemoteRepo } from './remoteRepo.js';
import type { ErrorResponse } from './types.js';
import { handlePackError } from './utils/errorHandler.js';
import { getProcessConcurrency } from './utils/processConcurrency.js';

// Log metrics
console.log('Server Process concurrency:', getProcessConcurrency());

const app = new Hono();

Expand Down
8 changes: 8 additions & 0 deletions website/server/src/utils/processConcurrency.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import os from 'node:os';

export const getProcessConcurrency = () => {
const cpuCount = typeof os.availableParallelism === 'function' ? os.availableParallelism() : os.cpus().length;

// Use all available CPUs except one
return Math.max(1, cpuCount - 1);
};

0 comments on commit 5c466e1

Please sign in to comment.