I have a controller that I am trying to grab XML files from remote sources.
Something like:
@artist = Nokogiri.XML(open(url).read)
However, I want to execute multiple of these at once getting different data. Can I use threads somehow?
Executing one by itself takes abut 400ms. So when they are executed three in a row the response is up to about 1s+.
Yes, you can use threads:
I’m not certain if writing to different keys in a shared hash requires a Mutex or not, but it doesn’t hurt to be safe.