问题
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