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

Fixed using Caching middleware with async adapter like Typhoeus #121

Merged
merged 2 commits into from
Oct 26, 2016

Conversation

kmamykin
Copy link
Contributor

All checks for response properties need to be done inside on_complete
And need to actually return the response.

Related to the lack of tests for parallel mode: See #100

All checks for response properties need to be done inside on_complete
And need to actually return the response.
if CACHEABLE_STATUS_CODES.include?(response.status)
response.on_complete { cache.write(key, response) }
# response.status is nil at this point, any checks need to be done inside on_complete block
response.on_complete do
Copy link
Member

Choose a reason for hiding this comment

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

I would prefer you to use

 @app.call(env).on_complete do |response|

instead of the longer

response = @app.call(env)
response.on_complete do

I also think is better to use the block parameter rather than the scope response

@iMacTia
Copy link
Member

iMacTia commented Oct 26, 2016

Thanks @kmamykin and sorry for the late reply.
I think you identified a legitimate bug and even though Typhoeus is not supported in Faraday (out-of-box) anymore this should be addressed.

I would simply ask you to fix what I highlighted in my review and pull latest changes from master to see if tests are green.

Thanks!

@iMacTia iMacTia self-assigned this Oct 26, 2016
@kmamykin
Copy link
Contributor Author

@iMacTia I made the change, and was very happy for a welcome disruption from my monotonous job. Thanks you. However rebasing and making the tests pass, I prefer to leave that in your capable hands, since you are already deep into it.

@iMacTia
Copy link
Member

iMacTia commented Oct 26, 2016

Good news is that after the changes all tests are now passing 👍!
Thanks for the fix

@iMacTia iMacTia merged commit 5c3f20c into lostisland:master Oct 26, 2016
mislav pushed a commit that referenced this pull request Nov 11, 2016
* Fixed using Caching middleware with async adapter like Typhoeus
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants