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

Response time is very slow compared to the same request using Typhoeus #156

Closed
ejlax opened this issue Dec 2, 2017 · 2 comments
Closed

Comments

@ejlax
Copy link

ejlax commented Dec 2, 2017

It seems that making a simple entries query using this library is much much slower than using a regular rest gem like Typhoeus. I can make the same call and get back the entries in roughly 1 sec compared to 15 when using this gem. Is anyone else noticing this slowness?

@dlitvakb
Copy link
Contributor

dlitvakb commented Dec 2, 2017

Hey @ejlax,

Looks like you may have your content with many circular references, that's causing the link resolution engine in this gem to have exponential resolution times because by default it tries to solve up to the 20th level - in order to allow to have elements up to the maximum nesting allowed by the API on a request, which is 10, and have that last element properly solve all it's reference tree if it includes an element that's previously present in the chain.

Do not worry, you can just adjust the maximum level by changing the value in the client configuration.

At client instantiation time:

client = Contentful::Client.new(
  space: 'space_id',
  access_token: 'your_access_token',
  dynamic_entries: :auto,
  raise_errors: true,
  max_include_resolution_depth: 5  # Change this number to what you need. It's usually recommended to set it to `include * 2`, but in the case of circular references, change it to `include + 1`.
)

Hope this helps,

Cheers

@dlitvakb
Copy link
Contributor

dlitvakb commented Dec 2, 2017

For more info, check this issue out: #124 (comment)

@dlitvakb dlitvakb closed this as completed Aug 2, 2018
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

No branches or pull requests

2 participants