allomov
9/12/2013 - 4:55 PM

cf-notes.md

Rails.logger.info "Running organizations object setter ---->"
Rails.logger.info "Fetch organizations: "
@organizations = client.organizations(depth: 2)
Rails.logger.info "Find current organization: "
@organization = @organizations.find { |o| o.guid == params[:id] } if params[:id]

Output of profiler:

Fetch organizations:
[2013-09-13 13:29:47]  0.575s     GET -> 200  /info
[2013-09-13 13:29:53]  5.544s     GET -> 200  /v2/organizations?inline-relations-depth=2
Find current organization:
[2013-09-13 13:29:53]  0.648s     GET -> 200  /v2/apps/3234a5d9-adec-4e8e-8221-e04724614ddd/routes?inline-relations-depth=1
[2013-09-13 13:29:50]  -3.062s     GET -> 200  /v2/apps/3234a5d9-adec-4e8e-8221-e04724614ddd/routes?inline-relations-depth=1
[2013-09-13 13:29:51]  0.609s     GET -> 200  /v2/apps/3234a5d9-adec-4e8e-8221-e04724614ddd/routes?inline-relations-depth=1
[2013-09-13 13:29:51]  0.603s     GET -> 200  /v2/apps/3234a5d9-adec-4e8e-8221-e04724614ddd/routes?inline-relations-depth=1
[2013-09-13 13:29:52]  0.605s     GET -> 200  /v2/apps/3234a5d9-adec-4e8e-8221-e04724614ddd/routes?inline-relations-depth=1

Pay attention that thtere is negative time on fifth line.

How to turn on profile option

client = CFoundry::Client.get(CONFIG[:cf_api], CFoundry::AuthToken.new(token, refresh_token))
client.base.rest_client.log = STDOUT

client.organizations(depth: 2) is evil.