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

NPM catalog schema change causes high CPU (#398) #437

Merged
merged 4 commits into from
Sep 10, 2015
Merged

NPM catalog schema change causes high CPU (#398) #437

merged 4 commits into from
Sep 10, 2015

Conversation

billti
Copy link
Member

@billti billti commented Sep 10, 2015

This is the fix for the NPM schema change causing the infinite loop and CPU usage - see #398 .

I took the opportunity to reduce the size of some of the test assets for the validation, as they were so huge they took forever to run, and added coverage for the new Array literal schema case. These tests are all passing now.

if (!string.IsNullOrEmpty(builder.Name)) {
var package = builder.Build();
InsertCatalogEntry(db, package);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should continue catching the ArgumentException - occasionally npm changes things about their schema (or some odd package gets published that is contrary to the entire schema) that causes us to parse things incorrectly. For instance, at some point a single package was appearing in the catalog with an array of homepages rather than a single list.

In these cases, we want to be able to fail gracefully with a small note about what failed rather than failing to retrieve the entire catalog.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK. Added roughly the same logging/handling into the ReadPackage function.

@mousetraps
Copy link
Contributor

left a few comments and lgtm after that

billti added a commit that referenced this pull request Sep 10, 2015
NPM catalog schema change causes high CPU (#398)
@billti billti merged commit 3446e1f into master Sep 10, 2015
@billti billti deleted the issue398 branch September 10, 2015 19:14
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.

3 participants