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

The org-users command gets user guid data multiple times #45

Closed
sykesm opened this issue Jan 9, 2014 · 6 comments
Closed

The org-users command gets user guid data multiple times #45

sykesm opened this issue Jan 9, 2014 · 6 comments

Comments

@sykesm
Copy link
Contributor

sykesm commented Jan 9, 2014

When the org-users command runs, it gets the organization guid by calling FindByName on the organization repository. The current FindByName code is using inline-releations-depth=1 which, in addition to returning the org guid, returns all of the users, managers, billing managers, and auditors.

The user information from the initial request is discarded and then additional requests are made to get the user guids by querying the managers, billing managers, and auditors endpoints. For large organizations, this results in a significant amount of wasted data retrieval and DB queries.

It seems like the initial org query shouldn't be using inline-relations-depth=1 for this path and it probably makes sense to review other paths as well.

GET /v2/organizations?q=name%3Aplayground&inline-relations-depth=1 HTTP/1.1
GET /v2/organizations/7a77ded9-f8eb-4355-967e-2e68eb2e72be/managers HTTP/1.1
GET /v2/organizations/7a77ded9-f8eb-4355-967e-2e68eb2e72be/billing_managers HTTP/1.1
GET /v2/organizations/7a77ded9-f8eb-4355-967e-2e68eb2e72be/auditors HTTP/1.1
@thansmann
Copy link

Hi @sykesm - do you have a script and fixtures to reproduce? This is going into CLI icebox, and it'll be easier to get to if we can get it repro'd quickly.

cc: @scottruitt

@scottruitt
Copy link
Contributor

@thansmann and @sykesm --

@tedsuo and I reviewed it. It's a legit issue, but one we probably won't tackle immediately. I'll prioritize this in the backlog.

Scott

@XenoPhex
Copy link
Contributor

XenoPhex commented Jul 2, 2014

It is undesirable to make unnecessary HTTP requests to product a single set of data. That truth should be self-evident.

Unfortunately, due to the nature of the CC API, we made the explicit choice to make requests for resources with inline-relations-depth=1 in all cases. It's a little complicated, but if you're interested we could explain it in more detail.

The short answer is that doing this helps us know (at compile time) that we're using the API correctly. A longer answer would probably address that this is a hack but that it's a useful hack that makes our code (and api) less complex and thus easier to reason about.

Feel free to continue commenting on this issue if you'd like to discuss it. It is unlikely that we would drastically change our internal API model (barring some features or new API that drove out these changes), so we'd like to consider this as closed.

@XenoPhex XenoPhex closed this as completed Jul 2, 2014
@sykesm
Copy link
Contributor Author

sykesm commented Jul 2, 2014

@XenoPhex the next time I'm in SF (end of the month) I'd welcome a discussion around inline-relations-depth=n. There are a number of scenarios where it makes a great deal of sense - even here. That said, it doesn't make make a lot of sense to me to get the data a second time when when you know you got it the first time.

@XenoPhex
Copy link
Contributor

XenoPhex commented Jul 3, 2014

Cool! Come on down!
Barker all the way

@sykesm
Copy link
Contributor Author

sykesm commented Jul 3, 2014

OMG! I won! :)

XenoPhex added a commit that referenced this issue Feb 14, 2018
- they are no longer necessary as the formulas have been removed from
said taps
nickjameswebb pushed a commit that referenced this issue May 26, 2020
- they are no longer necessary as the formulas have been removed from
said taps
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants