-
Notifications
You must be signed in to change notification settings - Fork 35
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
Use futuroscope to run API calls in the background #30
Conversation
It would be nice to have some kind of benchmark :P |
Also, I was thinking to enforce the use of NetHTTPPersistent (since it's supported by Faraday) to help reducing the number of connections. |
That would be great! Let's see if I can run some benchmarks tomorrow :) |
Could you explain where the speed improvements will come from? I'm not sure I see it. It seems like for most uses, the future will have to resolve for each object before the next one is created. For example, if I wanted to get the titles from an array of links: Hyperclient.new(url).links[:categories].each {|c| puts c.attributes.name }
Am I missing something? |
I rebased with current master. @josepjaume maybe you could provide some example code to show where the benefits could be? |
Merging, but not releasing a new version yet. We'll see if we run into any problems. |
Use futuroscope to run API calls in the background
I would propose to remove this again:
I think it would be more appropriate to use futures directly in an app where you are aware of the implications. |
I had to change some tests and add an
inspect
because otherwise the test would have died without letting the thread make its work.By calling
inspect
(or any other method, really) we force it to wait for a result.I believe the speed improvements will be enormous.