resque - ActiveRecord "SHOW TABLES" queries -



resque - ActiveRecord "SHOW TABLES" queries -

i'm using rails 2.3 project, resque processing background tasks.

activerecord "show tables" , "show fields from" query first time utilize model, caches it. issue resque forks new process every job, never cached, , activerecords run queries 1 time again on every job.

what recommended way forcefulness activerecord cache these queries? adding "model.inspect" of models in initializer helps, few "show tables" queries still remain.

in rake task have environment initialization resque, add together next snippet:

# create sure we've pre-loaded of schema info resque.before_first_fork activerecord::base.send(:subclasses).each { |klass| klass.columns } end

for example, in lib/tasks/resque.rake:

task :resque_environment => :environment # create sure we've pre-loaded of schema info resque.before_first_fork activerecord::base.send(:subclasses).each { |klass| klass.columns } end end

activerecord resque

Comments

Popular posts from this blog

iphone - Dismissing a UIAlertView -

c# - Can ProtoBuf-Net deserialize to a flat class? -

javascript - Change element in each JQuery tab to dynamically generated colors -