[Backgroundrb-devel] Getting results from a dead worker. example?
Ezra Zygmuntowicz
ezmobius at gmail.com
Tue Jan 23 14:03:42 EST 2007
On Jan 23, 2007, at 3:19 AM, Tomasz Kaye wrote:
> I'm having a little difficulty understanding how to retrieve results
> from deceased workers (from the documentation it seems that it is
> possible to do this).
>
> I pasted my simple test below. If anyone could point out what i
> should be doing differently i'd be very grateful.
>
> My test worker:
>
> class TestWorker < BackgrounDRb::Worker::RailsBase
> def do_work(args)
> results[:done_with_do_work] = true
> self.delete
> end
> end
> TestWorker.register
>
> My rake task:
>
> task :tester => :environment do
> k=MiddleMan.new_worker(
> :class => :test_worker
> )
> sleep 1 # the worker will die during this pause
> # next line gives a nil object error
> puts "done_with_do_work=#{MiddleMan.worker(k).results
> [:done_with_do_work]||"not available"}"
> end
I am thinking about changing the way we store results. I think it
might make a lot more sense to use a database table for results. The
Results worker has been problematic.
So for now I suggest storing any results you need in a db table and
get the results in rails from said table. I hope to have some time
soon to work on this but I am pretty busy at the moment.
Cheers-
-- Ezra Zygmuntowicz
-- Lead Rails Evangelist
-- ez at engineyard.com
-- Engine Yard, Serious Rails Hosting
-- (866) 518-YARD (9273)
More information about the Backgroundrb-devel
mailing list