Skip to content

Commit

Permalink
reuse connection object. Don't catch errors in AAS:Post.execute, alre…
Browse files Browse the repository at this point in the history
…ady done higher up in the call stack
  • Loading branch information
schoefmann committed Jun 19, 2009
1 parent 238db24 commit 0677474
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -6,3 +6,4 @@ coverage.data
solr/solr/data/*
.svn
test/db/*.db
.idea
13 changes: 6 additions & 7 deletions lib/acts_as_solr.rb
Expand Up @@ -51,15 +51,14 @@ def self.url
end
end

def self.connection
@@connection ||= Solr::Connection.new(url)
end

def self.execute(request)
begin
connection = Solr::Connection.new(url)
return connection.send(request)
rescue
raise "Couldn't connect to the Solr server at #{url}. #{$!}"
false
end
connection.send(request)
end

end

end
Expand Down

0 comments on commit 0677474

Please sign in to comment.