saturnflyer / radiant-vapor-extension

Creates an interface to manage the redirection of URLs in Radiant CMS
http://www.saturnflyer.com
MIT License
29 stars 15 forks source link

New redirections don't get propagated to other instances #8

Open bradg opened 12 years ago

bradg commented 12 years ago

I had an error where after a redirect was added it only worked occasionally. It appeared to be quite random.

The error was caused by storing the results of FlowMeter.all in a class variable (which is presumably done for speed). When you have multiple instances running (which is typical in a production environment) only the instance where the redirect was created had the new redirect while the other instances would return a 404. The other instances would return the redirection only after restarting them (as they reload from the database).

I've solved this in my system by storing FlowMeter.all in memcached (instead of @@all) but it's not a generic solution.

saturnflyer commented 12 years ago

Thanks for posting this. I've been meaning to get to it. Rails.cache will probably do the trick.