From: fedzor Date: 2008-02-13T10:10:36+09:00 Subject: Re: Rev/actor TCP monkey patching On Feb 12, 2008, at 5:30 PM, Tony Arcieri wrote: > # Capture the parent Actor to send messages to > parent = Actor.current > > # Spawn a new Actor for each URL we want to fetch > url_list.each do |u| > Actor.spawn do > # Request the URL > response = Revactor::HttpClient.get(u) > > # Consume and store the body if the response status was 200 > response.body if response.status == 200 > > # Close the connection > response.close > > parent << [:http_response, u, response] > end > end Here is where I've found a problemo will occur. In my *ahem* extensive *ahem* research with your fine fine actors ;-), concurrency only exists when run within an actor - Actor.current has failed me here! Example: foods = ['chocolate', 'seltzer', 'awesome sauce'] foods.each do |food| Actor.spawn(food) do |f| sleep 1 puts f end end puts "foods rounded up" # chocolate # foods rounded up Uhoh! Not quite. Lemme try something different - Well, whatever, I couldn't reproduce that code, because I updated to your svn code. The one released as a gem required me to embed it all within an actor before getting any sort of concurrency. But basically, I sent some snail mail to an actor and it waited on quitting until all of the internal actors finished working concurrently. It was really awesome and I understood it! And then I reinstalled revactor. oof! Better work something out. Do you think you could help me understand what I would need to do to get awesome sauce printed? Thanks, -------------------------------------------------------| ~ Ari if god gives you lemons YOU FIND A NEW GOD