From fdbf94a6216c91dbfb94166e36d7356f39496954 Mon Sep 17 00:00:00 2001 From: Bruce Krysiak Date: Wed, 16 Nov 2016 04:33:01 -0800 Subject: [PATCH] Use Typhoeus to help forked/threaded users --- lib/neo4j-server/cypher_session.rb | 3 ++- lib/neo4j/core/cypher_session/adaptors/http.rb | 3 ++- neo4j-core.gemspec | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/neo4j-server/cypher_session.rb b/lib/neo4j-server/cypher_session.rb index d49aee5d..f3e0709e 100644 --- a/lib/neo4j-server/cypher_session.rb +++ b/lib/neo4j-server/cypher_session.rb @@ -1,4 +1,5 @@ require 'uri' +require 'typhoeus/adapters/faraday' module Neo4j module Server @@ -31,7 +32,7 @@ def self.create_connection(params, url = nil) b.response :multi_json, symbolize_keys: true, content_type: 'application/json' # b.use Faraday::Response::RaiseError - b.use Faraday::Adapter::NetHttpPersistent + b.use Faraday::Adapter::Typhoeus # b.adapter Faraday.default_adapter end conn.headers = {'Content-Type' => 'application/json', 'User-Agent' => ::Neo4j::Session.user_agent_string} diff --git a/lib/neo4j/core/cypher_session/adaptors/http.rb b/lib/neo4j/core/cypher_session/adaptors/http.rb index c1019a3e..e2bbe3d3 100644 --- a/lib/neo4j/core/cypher_session/adaptors/http.rb +++ b/lib/neo4j/core/cypher_session/adaptors/http.rb @@ -1,6 +1,7 @@ require 'neo4j/core/cypher_session/adaptors' require 'neo4j/core/cypher_session/adaptors/has_uri' require 'neo4j/core/cypher_session/responses/http' +require 'typhoeus/adapters/faraday' # TODO: Work with `Query` objects module Neo4j @@ -143,7 +144,7 @@ def faraday_connection c.request :multi_json c.response :multi_json, symbolize_keys: true, content_type: 'application/json' - c.use Faraday::Adapter::NetHttpPersistent + c.use Faraday::Adapter::Typhoeus # c.response :logger, ::Logger.new(STDOUT), bodies: true diff --git a/neo4j-core.gemspec b/neo4j-core.gemspec index 0b385ce3..b65b534e 100644 --- a/neo4j-core.gemspec +++ b/neo4j-core.gemspec @@ -25,7 +25,7 @@ Neo4j-core provides classes and methods to work with the graph database Neo4j. s.rdoc_options = ['--quiet', '--title', 'Neo4j::Core', '--line-numbers', '--main', 'README.rdoc', '--inline-source'] s.add_dependency('faraday', '~> 0.9.0') - s.add_dependency('net-http-persistent', '~> 2.9.4') + s.add_dependency('typhoeus', '~> 1.1.0') s.add_dependency('httpclient') s.add_dependency('faraday_middleware', '~> 0.10.0') s.add_dependency('json')