Concurrent web requests with Ruby (Sinatra?)?
- by cbmeeks
I have a Sinatra app that basically takes some input values and then finds data matching those values from external services like Flickr, Twitter, etc.
For example:
input:"Chattanooga Choo Choo"
Would go out and find images at Flickr on the Chattanooga Choo Choo and tweets from Twitter, etc.
Right now I have something like:
@images = Flickr::...find...images..
@tweets = Twitter::...find...tweets...
@results << @images
@results << @tweets
So my question is, is there an efficient way in Ruby to run those requests concurrently? Instead of waiting for the images to finish before the tweets finish.
Thanks.