faraday_persistent_excon 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9d37899aeab18fc6d2c7ddd0c2916084f16fd9a9
4
- data.tar.gz: 1b7473207a1c333965cb2664209eec54cbcaa3f5
3
+ metadata.gz: 2f0541e32c8035065201b31a061ef823ee0d6f69
4
+ data.tar.gz: 0953f3ae6860d2ae94d1d20f41a18185f6b58045
5
5
  SHA512:
6
- metadata.gz: 3780a0356610228664824d43a5b03eaa5bb61495e2df54d1cf3819fc59ef7d3520e71c7cf01d1cf448e9d06702c5e5128364a2422dd6da942f9862d3c4e7de3e
7
- data.tar.gz: b0dd0f0ec8854b2d93fc8035e18707fa6892880b2de5e4bacd58261f2b7b024f0e660785dbc131cc13444e14129dac2d9b9bbf31abbb1c0a882b83af25d1d16e
6
+ metadata.gz: c42d6969cae3239192270273433a0189fadee7253abb89e22fe3781778f063c3f0d3519e9d1e28260c1c87a85780e480c1c028ee607d5895d010fc0f16674819
7
+ data.tar.gz: 31455c99c8c3a3a7ba7f17bad77397e24829f440c3da54d95e45a523dfd0a9e86e2899adbeb13954bd2224b875127c8f9764e1e14f597c9a0d0b69e7ab7f6deb
data/README.md CHANGED
@@ -1,8 +1,12 @@
1
1
  # FaradayPersistentExcon
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/faraday_persistent_excon`. To experiment with that code, run `bin/console` for an interactive prompt.
3
+ Adds configurable connection pools per host for persistent http connections
4
4
 
5
- TODO: Delete this and the text above, and describe your gem
5
+ ## Status
6
+
7
+ **Alpha**
8
+
9
+ All testing for this gem is currently in the form of bench testing. We're evaulating this gem in our production stack.
6
10
 
7
11
  ## Installation
8
12
 
@@ -22,7 +26,16 @@ Or install it yourself as:
22
26
 
23
27
  ## Usage
24
28
 
25
- TODO: Write usage instructions here
29
+ In an initializer:
30
+
31
+ ```ruby
32
+ Excon.defaults[:tcp_nodelay] = true
33
+ Faraday.default_adapter = :persistent_excon
34
+ FaradayPersistentExcon.connection_pools = {
35
+ 'https://search.example.com' => { size: 5 },
36
+ 'http://localhost:9200' => { size: 10, timeout: 2 }
37
+ }
38
+ ```
26
39
 
27
40
  ## Development
28
41
 
@@ -32,5 +45,5 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
32
45
 
33
46
  ## Contributing
34
47
 
35
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/faraday_persistent_excon.
48
+ Bug reports and pull requests are welcome on GitHub at https://github.com/aceofsales/faraday_persistent_excon.
36
49
 
@@ -26,14 +26,12 @@ module FaradayPersistentExcon
26
26
  end
27
27
 
28
28
  def connection_pool_for(url)
29
- config = FaradayPersistentExcon.connection_pools.find do |hsh|
30
- hsh[:url] == url
31
- end
29
+ config = FaradayPersistentExcon.connection_pools[url]
32
30
 
33
31
  if config
34
32
  self.__pools.fetch_or_store(url) do
35
- ::ConnectionPool.new(size: config[:size]) do
36
- ::Excon.new(config[:url], persistent: true, thread_safe_sockets: false)
33
+ ::ConnectionPool.new(config) do
34
+ ::Excon.new(url, persistent: true, thread_safe_sockets: false)
37
35
  end
38
36
  end
39
37
  end
@@ -1,3 +1,3 @@
1
1
  module FaradayPersistentExcon
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
@@ -19,7 +19,7 @@ module FaradayPersistentExcon
19
19
 
20
20
  self.excon_options = {}
21
21
  self.perform_request_class = FaradayPersistentExcon::PerformRequest
22
- self.connection_pools = []
22
+ self.connection_pools = {}
23
23
  end
24
24
 
25
25
  Faraday::Adapter.register_middleware persistent_excon: ->{ FaradayPersistentExcon::Adapter }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: faraday_persistent_excon
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Schlesinger
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-08-22 00:00:00.000000000 Z
11
+ date: 2015-08-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday