karmi/tire — Issue #220: Using Activerecord Observer on a model that uses elasticsearch/Tire slows down loading times
Author: ReLrO
Created: 2012-01-31 11:19:38+00:00
State: open

I have implemented the Tire gem in my application and lately wanted to use an observer on some of the models I also have Tire/elasticsearch on.
What happens is that because of the observer, elasticsearch is being invoked on each and every call when loading (not searching) a page. so for example, take a look at what's happening when getting an image:

Started GET "/assets/icons/landing-icons.png" for 127.0.0.1 at 2012-01-31 13:00:28 +0200
Served asset /icons/landing-icons.png - 304 Not Modified (2ms)
# 2012-01-31 13:00:28:976 [HEAD] ("development::application-questions")
#
curl -I "http://localhost:9200/development::application-questions"

# 2012-01-31 13:00:28:976 [200]

# 2012-01-31 13:00:28:998 [HEAD] ("development::application-answers")
#
curl -I "http://localhost:9200/development::application-answers"

# 2012-01-31 13:00:28:998 [200]

This really slows the loading time of a page. I want to keep using both features. Any idea how this could be solved?