I override some Rails'' configuration options in my project, like: config.database_configuration_file = "#{RAILS_ROOT}/local/config/ database.yml" But they aren''t picked up in BackgroundRB because Rails ActiveRecord is just initialized directly in MasterWorker#load_rails_env: db_config_file = YAML.load(ERB.new(IO.read("#{RAILS_HOME}/ config/database.yml")).result) Is this an intentional design decision, or just simplest approach tha''s "good enough?" Personally, I''d prefer that my Rails'' environment was initialized the same way in my client application, BackgroundRB server and the workers?and I''m happy to contribute a patch to do it. If it makes sense. Is this a dead end that''s been discussed before, or has just no one needed it before? Thanks for any info. Scott
I''m not a dev of backgroundrb, but in the two weeks I''ve been using it - this is definitely in need of repair. Look at this simple Google search of the list archive: http://tinyurl.com/6xk4g2 Intentional or not, folks are confused by it. BackgrounDRb developers - Thanks for all the hard work. I only want to encourage Scott to help you make it better ;) aiwilliams On May 4, 2008, at 7:09 PM, Scott Willson wrote:> I override some Rails'' configuration options in my project, like: > config.database_configuration_file = "#{RAILS_ROOT}/local/config/ > database.yml" > > But they aren''t picked up in BackgroundRB because Rails ActiveRecord > is just initialized directly in MasterWorker#load_rails_env: > db_config_file = YAML.load(ERB.new(IO.read("#{RAILS_HOME}/ > config/database.yml")).result) > > Is this an intentional design decision, or just simplest approach > tha''s "good enough?" Personally, I''d prefer that my Rails'' > environment was initialized the same way in my client application, > BackgroundRB server and the workers?and I''m happy to contribute a > patch to do it. If it makes sense. Is this a dead end that''s been > discussed before, or has just no one needed it before? > > Thanks for any info. > > Scott > > _______________________________________________ > Backgroundrb-devel mailing list > Backgroundrb-devel at rubyforge.org > http://rubyforge.org/mailman/listinfo/backgroundrb-devel
On May 4, 2008, at 4:09 PM, Scott Willson wrote:> I override some Rails'' configuration options in my project, like: > config.database_configuration_file = "#{RAILS_ROOT}/local/config/ > database.yml" > > But they aren''t picked up in BackgroundRB because Rails ActiveRecord > is just initialized directly in MasterWorker#load_rails_env: > db_config_file = YAML.load(ERB.new(IO.read("#{RAILS_HOME}/ > config/database.yml")).result)Hey folks, So this looks easy enough. You just need to change MetaWorker#load_rails_env to load the entire Rails environment rather than just read the database config + ActiveRecord. Patch attached (I apologize for not doing a nifty Git fork/patch). I''m a bit leery of side effects from this patch?your mileage may vary? but it does fix my issue and seems to work just fine in my app. Scott -------------- next part -------------- A non-text attachment was scrubbed... Name: meta_worker_rails_env.diff Type: application/octet-stream Size: 945 bytes Desc: not available URL: <http://rubyforge.org/pipermail/backgroundrb-devel/attachments/20080603/5f83758b/attachment.obj> -------------- next part --------------
On Wed, Jun 4, 2008 at 8:53 AM, Scott Willson <scott at butlerpress.com> wrote:> On May 4, 2008, at 4:09 PM, Scott Willson wrote: > >> I override some Rails'' configuration options in my project, like: >> config.database_configuration_file >> "#{RAILS_ROOT}/local/config/database.yml" >> >> But they aren''t picked up in BackgroundRB because Rails ActiveRecord is >> just initialized directly in MasterWorker#load_rails_env: >> db_config_file >> YAML.load(ERB.new(IO.read("#{RAILS_HOME}/config/database.yml")).result) > > Hey folks, > > So this looks easy enough. You just need to change MetaWorker#load_rails_env > to load the entire Rails environment rather than just read the database > config + ActiveRecord. Patch attached (I apologize for not doing a nifty Git > fork/patch). > > I''m a bit leery of side effects from this patch?your mileage may vary?but it > does fix my issue and seems to work just fine in my app.Can you please create this patch against git version : http://github.com/gnufied/backgroundrb/tree/master Here is a small, summary of changes in git version: http://gnufied.org/2008/05/21/bleeding-edge-version-of-backgroundrb-for-better-memory-usage/