Reputation: 10738
My rails application uses Koala to connect to Facebook.
I'm using batch calls to speed things up, and I'd like to make several calls in parallel in order to make it even faster.
What is the right way to make several calls in parallel in rails?
Is it safe to use threads within rails? how?
I saw some code that use Typhoeus, but if I'd use it i'll need to make the http calls to facebook myself, as opposed using Koala.
Any example code/guide for that?
Upvotes: 1
Views: 558
Reputation: 18845
using threads within rails is fine. you need to make sure that the libs you are using are thread-safe!
if you don't need live data i would rather use a queue like resque or sidekick instead. if you want to do a lot of threading, than you might be better of with something like celluloid: https://github.com/celluloid/celluloid/wiki/Basic-usage
Upvotes: 4