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

complete search rewrite #253

Merged
merged 3 commits into from
May 30, 2015
Merged

complete search rewrite #253

merged 3 commits into from
May 30, 2015

Conversation

rlidwka
Copy link
Owner

@rlidwka rlidwka commented May 16, 2015

Current search code is based on the PR #65, which was using a primitive approach:

  • get /-/all from npmjs
  • use JSON.parse() on it, trying to parse it's entire output into memory
  • print the entire json body to the client afterwards

Now that npm database it larger, the 3rd step is usually getting replaced with "eat up 2+GB of memory and crash" step.

So I changed it to use streaming, and now it works like this:

  • get /-/all from npmjs
  • use JSONStream and parse each package in the output
  • for each package, check permissions and write it to the client, proceed to the next one

This should fix most of our search-related issues. By the way, on my computer npm is still crashing trying to parse the entire all.json, so whoever has a time and patience for it, please check if this commit works. :)

rlidwka added a commit that referenced this pull request May 30, 2015
@rlidwka rlidwka merged commit d370e5a into master May 30, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant