Displaying 1 result from an estimated 1 matches for "start_crawling".
2008 Mar 25
0
Questions about backgroundrb
...age_name =>
"social_revolution",:user_id => x)
Where crawl_page is a method inside MyspaceWorker.
class MyspaceWorker<BackgrounDRb::MetaWorker
  def create
     @crawled_data = {}
     @data_mutex = Mutex.new
  end
  def crawl_page options = {}
     thread_pool.defer(options) { start_crawling(options)}
  end
  def start_crawling options
    # do your page crawling here
    result = magical_crawl(options[:page_name])
    # since multiple threads may write to the same hash, lets protect
it with a mutex
    @data_mutex.sycncronize do
       @crawled_data[options[:user_id]] = result
    en...