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

Duplicate objects in GoogleApis.toBeDiscovered #82

Merged
merged 8 commits into from
Aug 26, 2013
Merged

Duplicate objects in GoogleApis.toBeDiscovered #82

merged 8 commits into from
Aug 26, 2013

Conversation

bentona
Copy link
Contributor

@bentona bentona commented Aug 24, 2013

This could definitely be fixed on the client side, but since this was the only issue preventing the re-use of the same googleapis object with multiple calls to .discover, I thought you might want a PR. I was calling googleapis.discover(...) multiple times. Upon executing the request, discovering the same API repeatedly was causing a massive, mysterious slowdown.

@@ -107,8 +107,14 @@ GoogleApis.DISCOVERY_PARAMS_ = null;
* @return {GoogleApis} Returns itself.
*/
GoogleApis.prototype.discover = function(name, version, opt_opts) {
this.toBeDiscovered.push({
name: name, version: version, opts: opt_opts });
var alreadyDiscovered = this.toBeDiscovered.filter(function(discovery){

This comment was marked as spam.

This comment was marked as spam.

@rakyll
Copy link
Contributor

rakyll commented Aug 24, 2013

It'd also nice to add tests to tests/test.discovery.js

@bentona
Copy link
Contributor Author

bentona commented Aug 24, 2013

Thanks for the pointers, I'll take a shot at some tests shortly.

@rakyll
Copy link
Contributor

rakyll commented Aug 26, 2013

Thanks, LGTM.

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.

2 participants