Description
How does one create a fallback scheme when using mongo_store? For example, if one cannot connect to Mongo, it crashes the entire application.
BEGIN Error:
Mongo::ConnectionFailure (failed to connect to any given host:port):
mongo (1.0.8) lib/./lib/mongo/connection.rb:489:in connect' mongo (1.0.8) lib/./lib/mongo/connection.rb:137:in
initialize'
vendor/spree/lib/preference_access.rb:9:in []' vendor/extensions/sd_main/app/controllers/spree/base_controller.rb:273:in
set_user_language'
vendor/gems/hoptoad_notifier-2.2.2/lib/hoptoad_notifier/rack.rb:27:in call' /Users/conradwt/.rvm/rubies/ruby-1.8.7-head/lib/ruby/1.8/webrick/httpserver.rb:104:in
service'
/Users/conradwt/.rvm/rubies/ruby-1.8.7-head/lib/ruby/1.8/webrick/httpserver.rb:65:in run' /Users/conradwt/.rvm/rubies/ruby-1.8.7-head/lib/ruby/1.8/webrick/server.rb:173:in
start_thread'
/Users/conradwt/.rvm/rubies/ruby-1.8.7-head/lib/ruby/1.8/webrick/server.rb:162:in start' /Users/conradwt/.rvm/rubies/ruby-1.8.7-head/lib/ruby/1.8/webrick/server.rb:162:in
start_thread'
/Users/conradwt/.rvm/rubies/ruby-1.8.7-head/lib/ruby/1.8/webrick/server.rb:95:in start' /Users/conradwt/.rvm/rubies/ruby-1.8.7-head/lib/ruby/1.8/webrick/server.rb:92:in
each'
/Users/conradwt/.rvm/rubies/ruby-1.8.7-head/lib/ruby/1.8/webrick/server.rb:92:in start' /Users/conradwt/.rvm/rubies/ruby-1.8.7-head/lib/ruby/1.8/webrick/server.rb:23:in
start'
/Users/conradwt/.rvm/rubies/ruby-1.8.7-head/lib/ruby/1.8/webrick/server.rb:82:in `start'
END Error:
BTW, I have the following within my production.rb:
Set the cache store for Mongod.
config.cache_store = :mongo_store
In short, I would prefer that it work similar to memcached where it doesn't crash the Rails application when memcached is down.