mongoid/mongoid — Issue #1360: Setting an observer makes the assets very slow
Author: maximeg
Created: 2011-10-20 15:17:50+00:00
State: open

Today, i decided to use observers.

I created an ActivityObserver and I set it up in config/application.rb :

config.mongoid.observers = :activity_observer

And it makes the assets very slow to serve in development mode while navigating in the app.
Each assets take more than 500ms to load (even if the response is just 304) leading to a page loading time greater than 6s !
Development navigation becomes impossible.

I removed the config options, and it became normal (global loading time of 1-2s).
I set it up again, slow again.

I use rails 3.1.1 & mongoid 2.3.2.
And there is the observer :

# encoding: utf-8
class ActivityObserver < Mongoid::Observer
observe :task, :note

def after_create(record)
[...]
end
[...]
end