Permalink
Browse files

Skip connection errors during start up

Change-Id: I47b15e78a80106d1b9f92569fb9133498912380a
  • Loading branch information...
1 parent 42d7fb4 commit 00fd78d6b1bfbbb510b8913ee8c7f7ac675eb90c @avsej committed Apr 4, 2012
Showing with 7 additions and 10 deletions.
  1. +7 −10 lib/couchbase/railtie.rb
@@ -100,28 +100,25 @@ def self.rescue_responses
end
end
- # Setup where design documents are located
- initializer "couchbase.set_design_documents_path" do
- config.after_initialize do
- end
- end
-
# Check (and upgrade if needed) all design documents
- initializer "couchbase.upgrade_design_documents" do |app|
+ initializer "couchbase.upgrade_design_documents", :after =>"couchbase.setup_connection" do |app|
config.to_prepare do
::Couchbase::Model::Configuration.design_documents_paths ||= app.config.paths["app/models"]
app.config.paths["app/models"].each do |path|
Dir.glob("#{path}/**/*.rb").sort.each do |file|
require_dependency(file.gsub("#{path}/" , "").gsub(".rb", ""))
end
end
- ::Couchbase::Model.descendants.each do |model|
- model.ensure_design_document!
+ begin
+ ::Couchbase::Model.descendants.each do |model|
+ model.ensure_design_document!
+ end
+ rescue ::Couchbase::Error::Timeout, ::Couchbase::Error::Connect
+ # skip connection errors for now
end
end
end
-
# Set the proper error types for Rails. NotFound errors should be
# 404s and not 500s, validation errors are 422s.
initializer "couchbase.load_http_errors" do |app|

0 comments on commit 00fd78d

Please sign in to comment.