[Backgroundrb-devel] [ANN] BackgrounDRb New release.

Ezra Zygmuntowicz ezmobius at gmail.com
Sat Jul 1 19:53:09 EDT 2006

Howdy Folks-

	I'm happy to announce a new release of BackgrounDRb! I have added  
quite a few new features and included some nice patches from folks on  
the list.

$ script/plugin install svn://rubyforge.org//var/svn/backgroundrb

	All of the code now stays within the plugin and the start and stop  
scripts are now just stubs. This makes it easier to tweak or figure  
out how it works. The backgroundrb.rb file in the root of the plugin  
dir is the drb server part of MiddleMan and the pluginroot/lib/ 
backgroundrb.rb file is the rails client side MiddleMan.

	One of the new things is much better threading job control. This is  
mostly invisible to you as a user of the plugin but it makes the  
whole system a lot more sturdy. It gives your worker objects the  
chance to clean up after themselves when they get deleted instead of  
just getting the kill brick dropped on them ;) Thanks to David  
Lemstra for the job management code!

	The other big new feature is a built in timer and a time to live  
argument for workers and caches. This allows you to set how long a  
worker or a cache survives before it gets reaped.  The :ttl param  
defaults to 30 minutes for worker classes and 10 minutes for cached  
objects. If you don;t specify the :ttl param then thats how long your  
stuff will last. If you want longer or shorter ttl's then  
specify :ttl in *seconds* like this:

session[:job_key] = MiddleMan.new_worker(:class => :foo_worker,
           :args => "Bar",
           :ttl => 300) # 300 seconds == 5 minutes


#fill_cache, expire in 5 minutes
@posts = Post.find(:all, :include => :comments)
MiddleMan.cache_as(:post_cache, 300, @posts)
@posts = MiddleMan.cache_as :post_cache, 300 do
   Post.find(:all, :include => :comments)

@posts = MiddleMan.cache_get :post_cache do
   Post.find(:all, :include => :comments)

	By default the timer_sleep is set to 60 seconds. This means that the  
timer will wakeup every 60 seconds and delete caches and worker that  
are past their time to live. You can change this in the config file  
if you want it to run faster or slower.

	All your worker classes should now inherit from BackgrounDRb::Rails  
so they get all the good new thread management features. If you are  
already using the plugin you should delete the plugin from your rails  
app and reinstall it. You should also delete the script/backgroundrb  
directory and the config/backgroundrb.yml file. Then run:

# to install the new code.
$ rake backgroundrb:setup

Your workers should not need to change as long as they inherit from  
BackgrounDRb::Rails. Please test this and give me feedback if you are  
using it. I would also like to start collecting worker classes or at  
least hear what folks are using this plugin for.

*Home page: http://backgroundrb.rubyforge.org
*svn repo: svn://rubyforge.org//var/svn/backgroundrb
*Mailing list: http://rubyforge.org/mailman/listinfo/backgroundrb-devel


More information about the Backgroundrb-devel mailing list