Merge branch 'master' of github.com:diaspora/diaspora
This commit is contained in:
commit
c7cd9792ae
3 changed files with 22 additions and 1 deletions
|
|
@ -1,3 +1,4 @@
|
|||
require 'lib/mongo_mapper/clear_dev_memory'
|
||||
Diaspora::Application.configure do
|
||||
# Settings specified here will take precedence over those in config/environment.rb
|
||||
|
||||
|
|
@ -17,5 +18,6 @@ Diaspora::Application.configure do
|
|||
# Don't care if the mailer can't send
|
||||
config.action_mailer.raise_delivery_errors = false
|
||||
config.active_support.deprecation = :log
|
||||
config.middleware.use MongoMapper::ClearDevMemory
|
||||
#config.threadsafe!
|
||||
end
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ max_conns: 1024
|
|||
require: []
|
||||
|
||||
max_persistent_conns: 512
|
||||
environment: production
|
||||
environment: development
|
||||
servers: 1
|
||||
daemonize: true
|
||||
#chdir: /usr/applications/localhash/current
|
||||
|
|
|
|||
19
lib/mongo_mapper/clear_dev_memory.rb
Normal file
19
lib/mongo_mapper/clear_dev_memory.rb
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
module MongoMapper
|
||||
class ClearDevMemory
|
||||
def initialize(app)
|
||||
@app = app
|
||||
end
|
||||
|
||||
def call(env)
|
||||
if Rails.configuration.cache_classes
|
||||
else
|
||||
MongoMapper::Document.descendants.each do |m|
|
||||
m.descendants.clear if m.respond_to? :descendants
|
||||
end
|
||||
MongoMapper::Document.descendants.clear
|
||||
MongoMapper::EmbeddedDocument.descendants.clear
|
||||
end
|
||||
@app.call(env)
|
||||
end
|
||||
end
|
||||
end
|
||||
Loading…
Reference in a new issue