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:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 2f0541e32c8035065201b31a061ef823ee0d6f69
|
|
4
|
+
data.tar.gz: 0953f3ae6860d2ae94d1d20f41a18185f6b58045
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c42d6969cae3239192270273433a0189fadee7253abb89e22fe3781778f063c3f0d3519e9d1e28260c1c87a85780e480c1c028ee607d5895d010fc0f16674819
|
|
7
|
+
data.tar.gz: 31455c99c8c3a3a7ba7f17bad77397e24829f440c3da54d95e45a523dfd0a9e86e2899adbeb13954bd2224b875127c8f9764e1e14f597c9a0d0b69e7ab7f6deb
|
data/README.md
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
# FaradayPersistentExcon
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Adds configurable connection pools per host for persistent http connections
|
|
4
4
|
|
|
5
|
-
|
|
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
|
-
|
|
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/
|
|
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
|
|
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(
|
|
36
|
-
::Excon.new(
|
|
33
|
+
::ConnectionPool.new(config) do
|
|
34
|
+
::Excon.new(url, persistent: true, thread_safe_sockets: false)
|
|
37
35
|
end
|
|
38
36
|
end
|
|
39
37
|
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.
|
|
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-
|
|
11
|
+
date: 2015-08-24 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: faraday
|