Hi,

 

Am finally getting around to upgrading our backgroundrb from 1.0.1 to
the current SVN release (1.0.4?).  Most things are working quite well.

 

But ...  I was looking forward to using the reload_on_schedule option on
several memory hungry workers that don't run that often, but am running
into a problem: even using memcached for result storage, I'm unable to
see cached results from workers started with 'reload_on_schedule true'.

 

I created two nearly identical workers:

 

class HarvesterWorker < BackgrounDRb::MetaWorker

  set_worker_name :harvester_worker

  reload_on_schedule true

 

  def create(args = nil)

    @counter = 0

    logger.info "Harvester created (pid #{Process.pid})"

    cache['result'] = @counter

  end

 

  def run(args = nil)

    @counter += 1

    logger.info "Harvester run called: [EMAIL PROTECTED]"

    cache['result'] = @counter

  end

end

 

and

 

class Harvester2Worker < BackgrounDRb::MetaWorker

  set_worker_name :harvester2_worker

 

  def create(args = nil)

    @counter = 0

    logger.info "Harvester2 created (pid #{Process.pid})"

    cache['result'] = @counter

  end

 

  def run(args = nil)

    @counter += 1

    logger.info "Harvester2 run called: [EMAIL PROTECTED]"

    cache['result'] = @counter

  end

end

 

The only real difference between the workers is that HarvesterWorker
uses the reload_on_schedule option, and Harvester2Worker does not.

I scheduled each worker to exec the run method every 15 seconds, and
configured backgroundrb to use memcached for result storage.   The log
file shows the workers are running correctly.  However:

 

MiddleMan.worker(:harvester_worker).ask_result('result') always returns
nil, while

 

MiddleMan.worker(:harvester2_worker).ask_result('result') returns a
correct result.

 

I.e., the worker running with 'reload_on_schedule true' doesn't seem to
be caching the result.

 

Any thoughts?  Thanks!

 

Tom Wood

[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> 

ITS Applications Developer

University of Connecticut Libraries

 

_______________________________________________
Backgroundrb-devel mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/backgroundrb-devel

Reply via email to