[Backgroundrb-devel] Feedback on RC2

hemant kumar gethemant at gmail.com
Sat Dec 8 01:50:59 EST 2007


On Fri, 2007-12-07 at 16:09 +0530, hemant wrote:
> On Dec 7, 2007 8:45 AM, Andy Tyra <andy.tyra at gmail.com> wrote:
> > Sure, here is the worker code in its entirety.  For a little background,
> > this is using the test framework to call a controller function which
> > executes and renders a report.  It's done this way because the previous
> > version of backgroundrb did not support accessing and calling controllers.
> > (If this has changed, that would be awesome, but I'm guessing it has not.)
> > That's what the extra "FakeTest" class is for.
> >
> > require 'active_support'
> > require 'action_controller'
> > require 'action_controller/test_process'
> > require 'action_view'
> >
> > class ExpireAndRefreshWorker < BackgrounDRb::MetaWorker
> >   set_worker_name :expire_and_refresh_worker
> >   def create(args = nil)
> >     # this method is called, when worker is loaded for the first time
> >   end
> >
> >
> >   def execute_report(report_name)
> >         myReport = Report.new(report_name)
> >         begin
> >                 File.delete(File.join(RAILS_ROOT, 'public','reports',
> > myReport.const_name + '.html'))
> >         rescue
> >                 #do nothing
> >          end
> >         renderController = FakeTest.new
> >         renderController.render_report(myReport)
> >         return "I am done."
> >   end
> >
> >   def process_request(p_data)
> >     user_input = p_data[:data]
> >     result = self.send(user_input[:worker_method],user_input[:data])
> >     send_response(p_data,result)
> >   end
> > end
> >
> > class FakeTest
> >
> >         include ActionController::TestProcess
> >
> >         def initialize
> >                 require_dependency 'application' unless
> > defined?(ApplicationController)
> >                 @controller = ReportsController.new
> >                 @request = ActionController::TestRequest.new
> >                  @response = ActionController::TestResponse.new
> >         end
> >
> >         def render_report(myReport)
> >                 get :run, {:id => myReport.const_name}
> >                 @response
> >         end
> > end
> >
> >

Hi Andy,

Sync with latest source code. The bug you encountered should be fixed
now.

And get rid of older ./script/backgroundrb file and do a setup using:

rake backgroundrb:setup 

Also, now in configuration
file you can mention:

backgroundrb.yml:

:backgroundrb:
  :port: 11006
  :ip: 0.0.0.0
  :log: foreground

and start backgroundrb in foreground mode using:

./script/backgroundrb

this would make sure that all the exceptions appear on stdout. Give it a
shot...





More information about the Backgroundrb-devel mailing list