Class: FakeSolrTimeoutResponse

Inherits:
Net::HTTPRequestTimeOut
  • Object
show all
Defined in:
indexer/app/lib/fake_solr_timeout_response.rb

Overview

This is a faked response for a solr timeout. Why? In some cases, Solr will timeout, but there will be no response. Instead Ruby will raise a Timeout::Error, which the indexer does not handle, causing the indexer to crash in the index round. Instead we will rescue the timeout error and return this faked response.

Instance Method Summary collapse

Constructor Details

#initialize(req) ⇒ FakeSolrTimeoutResponse

Returns a new instance of FakeSolrTimeoutResponse.



9
10
11
12
# File 'indexer/app/lib/fake_solr_timeout_response.rb', line 9

def initialize(req)
  @req = req 
  super('1.0', '408', 'SOLR TIMEOUT ERROR') 
end

Instance Method Details

#read_body(*args) {|@body| ... } ⇒ Object

This needs to be added so Net::HTTP stream check passes.

Yields:

  • (@body)


16
17
18
19
20
21
22
23
24
25
# File 'indexer/app/lib/fake_solr_timeout_response.rb', line 16

def read_body(*args, &block)
  @body = "
Timeout error with #{@req.uri} #{@req.method} #{@req.body}.
Please check your :indexer_solr_timeout_seconds, :indexer_thread_count, and :indexer_records_per_thread settings in 
your config.rb file.
Also check https://wiki.apache.org/solr/SolrPerformanceProblems for possible performance issues.
  " 
  yield @body if block_given?
  @body
end