Skip to content

Commit

Permalink
fix: increase mem + round downloadRatio (#644)
Browse files Browse the repository at this point in the history
  • Loading branch information
Samuel Bodin committed Jul 5, 2021
1 parent 3968726 commit 8ef8425
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 2 additions & 2 deletions package.json
Expand Up @@ -14,8 +14,8 @@
"doctoc": "doctoc --notitle --maxlevel 3 README.md",
"lint": "eslint --ext=jsx,ts,tsx,js .",
"prepare": "husky install",
"start": "UV_THREADPOOL_SIZE=12 node -r dotenv/config --async-stack-traces --max-old-space-size=420 dist/index.js",
"start_new": "indexName=npm-search-new bootstrapIndexName=npm-search-new.tmp UV_THREADPOOL_SIZE=22 node --async-stack-traces --max-old-space-size=420 dist/index.js",
"start": "UV_THREADPOOL_SIZE=12 node -r dotenv/config --async-stack-traces --max-old-space-size=920 dist/index.js",
"start_new": "indexName=npm-search-new bootstrapIndexName=npm-search-new.tmp UV_THREADPOOL_SIZE=22 node --async-stack-traces --max-old-space-size=920 dist/index.js",
"test:watch": "jest --watchAll --no-watchman",
"test": "jest --forceExit"
},
Expand Down
4 changes: 3 additions & 1 deletion src/npm/index.ts
Expand Up @@ -272,7 +272,9 @@ async function getDownloads(pkgs: Array<Pick<RawPkg, 'name'>>): Promise<
const downloadsLast30Days = downloadsPerPkgName[name]
? downloadsPerPkgName[name].downloads
: 0;
const downloadsRatio = (downloadsLast30Days / totalNpmDownloads) * 100;
const downloadsRatio = Number(
((downloadsLast30Days / totalNpmDownloads) * 100).toFixed(4)
);
const popular = downloadsRatio > config.popularDownloadsRatio;
const downloadsMagnitude = downloadsLast30Days
? downloadsLast30Days.toString().length
Expand Down

0 comments on commit 8ef8425

Please sign in to comment.