Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Raise RuntimeError if a bulk query did not succeed after 5 tries. (in…

…stead of just printing to STDERR)
  • Loading branch information...
commit 4b491386d74f3b8648e53071e0e176e0e3e4f5ba 1 parent 1d6b267
@nfo authored
Showing with 5 additions and 2 deletions.
  1. +1 −0  lib/tire/index.rb
  2. +4 −2 test/unit/index_test.rb
View
1  lib/tire/index.rb
@@ -92,6 +92,7 @@ def bulk_store documents
retry
else
STDERR.puts "[ERROR] Too many exceptions occured, giving up. The HTTP response was: #{error.message}"
+ raise
end
ensure
View
6 test/unit/index_test.rb
@@ -353,10 +353,12 @@ class MyDocument;end; document = MyDocument.new
end
- should "try again when an exception occurs" do
+ should "try again and then raise when an exception occurs" do
Configuration.client.expects(:post).returns(mock_response('Server error', 503)).at_least(2)
- assert !@index.bulk_store([ {:id => '1', :title => 'One'}, {:id => '2', :title => 'Two'} ])
+ assert_raise(RuntimeError) do
+ @index.bulk_store([ {:id => '1', :title => 'One'}, {:id => '2', :title => 'Two'} ])
+ end
end
should "display error message when collection item does not have ID" do
Please sign in to comment.
Something went wrong with that request. Please try again.