Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: increase mem + round downloadRatio #644

Merged
merged 2 commits into from
Jul 5, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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