backgroundrb concurrent client access, results services


  Stay away from the results worker and just use methods and instance variables. The results worker is only useful if you want to keep some results around after you kill your worker. ALso the results worker is a tad broken right now as well.

  If you need to have multiple access to variables in a worker then you may need to synchronize access to instance variables and methods with a mutex. add a 'lock' helper method like this to your worker:

def lock
   @_lock ||=
   @_lock.synchronize { yield }

  And then use it every time you have an area of code that could get accessed by multiple clients at once:

def important_method
   lock do
     # some important thing in here that only
     #should be accessed by one thread at a time

-- Ezra Zygmuntowicz-- Founder & Ruby Hacker
-- Engine Yard, Serious Rails Hosting
-- (866) 518-YARD (9273)