Datamapper & connection pool logic

独自空忆成欢 提交于 2019-12-11 04:02:13

问题


So I am trying to use datamapper inside my Rails 3.2.8 app.

I have a config/initializers/dm.rb where I load the database.yml

hash = YAML.load(File.new("database.yml"))
DataMapper.setup(:default, hash[Rails.env])

I have a pool property set in the database.yml file, but I noticed that datamapper does not use that. It has this magic number 8 which it uses, where is this number coming from? And how can I configure pool settings for datamapper.


回答1:


just after DataMapper.finalize I add this for my tests ( with 'sqlite3::memory:' ) to reduce the poolsize to 1

class DataObjects::Pooling::Pool
  alias :initialize_old :initialize
  def initialize(max_size, resource, args)
    initialize_old( 1, resource, args)
  end
end


来源:https://stackoverflow.com/questions/12865104/datamapper-connection-pool-logic

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!