Skip to content

Commit

Permalink
Add a TODO
Browse files Browse the repository at this point in the history
  • Loading branch information
benjie committed Jun 26, 2024
1 parent 5d16fad commit 8669ce1
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,11 @@ function defaultCount() {
const memory = os.freemem();
const memoryCoreLimit = Math.floor(memory / (1.5 * GB));

// TODO: we should never run more workers than total number of documents
// divided by ~500 otherwise we get diminishing returns (and even slowdown on
// high core machines!). Need to have an idea of how many documents to
// expect.

// Return at least 1, at most `cores` and at most `memoryCoreLimit`
return Math.max(1, Math.min(memoryCoreLimit, cores));
}
Expand Down

0 comments on commit 8669ce1

Please sign in to comment.