From zackham at gmail.com Thu Jul 23 02:56:48 2009 From: zackham at gmail.com (Zack Ham) Date: Wed, 22 Jul 2009 23:56:48 -0700 Subject: [Backgroundrb-devel] successive asynchronous calls not happening Message-ID: Hello, I am running a job asynchronously three successive times in a loop with different parameters. Only the first call happens, and the two other calls just get dropped. If I sleep in between my async calls, all three occur. All three calls work correctly, without sleep, on a different machine running Ubuntu. I am running OS X 10.5.6 and am using memcache for my result storage, although not sure if that is relevant. The calls I am making look like this: MiddleMan.worker(:master_worker).async_process_job(:arg => {:job => :generate_static_map, :path => Route.static_image_path(id, preset), :width => width, :height => height, :data => self.data_full}) Any ideas? I've been tinkering around with this for a while and am coming up empty handed. Thanks, Zack From gviguier at cs.umass.edu Sat Jul 25 17:07:14 2009 From: gviguier at cs.umass.edu (Guillaume Viguier-Just) Date: Sat, 25 Jul 2009 17:07:14 -0400 Subject: [Backgroundrb-devel] Internet cafe application Message-ID: <8cad8cf30907251407j4227e6f6ic2688c4cbed4e07a@mail.gmail.com> Hello, I'm trying to achieve the following: an Internet cafe server application written using RoR which will receive timecodes from clients (for example: abcdefgh). These timecodes will be looked up in a database and, if a match is found in the database, a timer will be started on the server (and should be started in a new thread), which will, amongst other things, decrement the time that is left for this specific timecode every minute. I hope I'm being clear... I've looked at backgroundrb and it seems to be the right tool to achieve this but, even after reading the website documentation, I'm still confused on how I could achieve this. I started implementing it in the following way: class ClientsController def connect_timecode # check timecode and if timecode is valid: MiddleMan.new_worker(:worker => :timer_worker, :worker_key => @client.session_id) end end class TimerWorker < BackgrounDRb::MetaWorker set_worker_name :timer_worker def create(args = nil) add_periodic_timer(60) { decrement_time } end def decrement_time key = worker_key logger.debug('worker key: #{key}') end end Problem is: - this displays "worker key: nil" all the time, which means that for some reason the worker key is nil and this will not allow me to retrieve the client by its session id and perform some operations on the client - I'm not sure whether the approach I'm using is right Any help on this would be greatly appreciated. Thank you. -- Guillaume Viguier-Just From malletto at gmail.com Thu Jul 30 12:33:37 2009 From: malletto at gmail.com (Michael Alletto) Date: Thu, 30 Jul 2009 11:33:37 -0500 Subject: [Backgroundrb-devel] persistent task queues and thread pools Message-ID: <49536fef0907300933j65092c44q8c909e192315c072@mail.gmail.com> I have enabled persistent task queues and it is working but I want to limit how many tasks run based on the thread pool. The task calls inside my worker def do_work(id) pool_size 2 thread_pool.defer(:do_ocr, id) end the worker then has do_ocr which contains the actual work to be done. I would like the task queue to check on a 1 second time frame so stuff is processed as fast as possible, but I do not want more than 2 running at a time. If I set the persistent_delay to 1 second it launches 1 queued task each second ignoring the pool_size of 2. Is there anyway to have the persistent task queue obey the pool_size limit and react the way I expected it to act? Or have the task queue wake and grab x number of tasks out of the queue at a time as well as obeying the pool_size on a worker by worker basis? I'm using the latest git code. -------------- next part -------------- An HTML attachment was scrubbed... URL: