I'm using DRb within a Rails application to offload an expensive task outside the Rails process. Before initializing the client stub with DRbObject.new it is necessary to initialize the DRb service with DRb.start_service.
Doing this in model or controller appears to leave threads in an uncertain state. When I exit mongrel it says:
Reaping 1 threads for slow workers because of 'shutdown'
Waiting for 1 requests to finish, could take 60 seconds.
Initializing the service in environment.rb seems to work fine with a big caveat: I'm also using backgroundrb with some rails workers. When they initialize they run environment.rb and again lead to issues due to double-initialization.
Where is the correct place to call DRb.start_service in the client? Or, is there a way to test for initialization so I can avoid doing it twice for the same process?