The index page of my rails app grabs an rss feed from a neighboring news site. Unfortunately, the process of grabbing that feed seems to be slowing down the initial load time of my site to the point where it takes about 10-12 seconds to respond and render. I'd like to speed that up somehow (for 8-10 seconds it looks like my server is not responding at all..) Any suggestions? I found this: http://blog.codahale.com/2006/04/10/content-only-c... But as soon as I modified my controller from < Application to < ActionController::Base it stop rendering my page (which I guess is expected but I have no idea how to workaround that.) can somebody please help me with this?
on 2006-06-14 16:01
on 2006-06-14 21:06
Vince W. wrote: > > But as soon as I modified my controller from < Application to < > ActionController::Base it stop rendering my page (which I guess is > expected but I have no idea how to workaround that.) > > can somebody please help me with this? > > The way I do it is to have a table/model for the feed_items, with a created_at field (and also a feed model, which has_many feed_items). Then in the Feed model I have a update_feeds class method which first checks when the most recent feed_item for that feed was updated. If it's less than 20 minutes ago(if !f.checked_at || f.checked_at < 20.minutes.ago), it checks the feed again; if not, it returns the feed_items from the db. The method's a little more complicated than that, so it doesn't replace feed items it's already got, but that's the basic idea. HTH