Faraday :: ConnectionFailed:读取函数返回有趣值

时间:2019-01-19 10:38:47

标签: ruby-on-rails ruby elasticsearch faraday

对于从一个应用程序到Rails应用程序的大型(1 MB)数据同步,我收到此错误,并且在同步后,我正在做Elasticsearch索引编制。 以前,我使用ruby 2.3.3和rails 4.2.7可以很好地处理大数据,但是现在我将ruby更新为2.5.1和rails 4.2.10并在索引大数据时给出了Faraday::ConnectionFailed: read function returned funny value错误。 / p>

尝试了Elasticsearch gem的列出版本

elasticsearch(6.1.0,2.0.2) elasticsearch-api(6.1.0,2.0.2) elasticsearch-model(6.0.0,2.0.1) elasticsearch-rails(6.0.0,2.0.1) elasticsearch-transport(6.1.0,2.0.2)

还尝试过faraday和faraday_middleware gem更新

法拉第(0.15.4,0.9.2) faraday_middleware(0.12.2)

适配器和版本为:gem'patron','〜> 0.4.18'

gemfile.lock的详细信息

elasticsearch (2.0.2)
  elasticsearch-api (= 2.0.2)
  elasticsearch-transport (= 2.0.2)
elasticsearch-api (2.0.2)
  multi_json
elasticsearch-model (2.0.1)
  activesupport (> 3)
  elasticsearch (~> 2)
  hashie
elasticsearch-rails (2.0.1)
elasticsearch-transport (2.0.2)
  faraday
  multi_json

faraday (0.9.2)
  multipart-post (>= 1.2, < 3)
faraday_middleware (0.12.2)
  faraday (>= 0.7.4, < 1.0)

googleauth (0.5.1)
  faraday (~> 0.9)

oauth2 (1.0.0)
  faraday (>= 0.8, < 0.10)
  jwt (~> 1.0)
  multi_json (~> 1.3)
  multi_xml (~> 0.5)
  rack (~> 1.2)
omniauth (1.8.1)
  hashie (>= 3.4.6, < 3.6.0)
  rack (>= 1.6.2, < 3)
omniauth-oauth2 (1.2.0)
  faraday (>= 0.8, < 0.10)
  multi_json (~> 1.3)
  oauth2 (~> 1.0)
  omniauth (~> 1.2)

signet (0.7.3)
  addressable (~> 2.3)
  faraday (~> 0.9) 

还尝试使用this SO question中的想法:

Elasticsearch::Model.client = Elasticsearch::Client.new(log: logging, adapter: :patron, url: ENV['ELASTICSEARCH_URL'], retry_on_failure: true, transport_options: {request: {timeout: 250}})

错误详细信息:

[Faraday::ConnectionFailed] Cannot connect to {:scheme=>"https", :user=>nil, :password=>nil, :host=>"example.com", :path=>"", :port=>443, :protocol=>"https"} after 4 tries
rake aborted!
Faraday::ConnectionFailed: read function returned funny value
/www/rails/app/models/concerns/searchable.rb:34:in `index_document'
/www/rails/lib/drupal/drupal_changes.rb:21:in `block (2 levels) in process'
/www/rails/lib/drupal/drupal_changes.rb:12:in `block in process'
/www/rails/lib/drupal/drupal_changes.rb:9:in `loop'
/www/rails/lib/drupal/drupal_changes.rb:9:in `process'
/www/rails/lib/tasks/drupal_change_syncronizer.rake:106:in `block (2 levels) in <top (required)>'
/www/rails/lib/tasks/drupal_change_syncronizer.rake:115:in `block (3 levels) in <top (required)>'
/www/rails/lib/tasks/drupal_change_syncronizer.rake:13:in `if_not_syncing'
/www/rails/lib/tasks/drupal_change_syncronizer.rake:112:in `block (2 levels) in <top (required)>'
/opt/rubies/ruby-2.5.1/bin/bundle:30:in `block in <main>'
/opt/rubies/ruby-2.5.1/bin/bundle:22:in `<main>'
Patron::Error: read function returned funny value

1 个答案:

答案 0 :(得分:0)

我已经将守护神的工作版本更新为最新版本0.13.1。