we-call 0.6.0 → 0.6.1.pre.alpha1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +6 -6
- data/lib/we/call/connection.rb +3 -4
- data/lib/we/call/version.rb +1 -1
- data/lib/we/call.rb +4 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cf7b5c54d9eb24a040dc0ecb5bb9aca3b7c8ca97
|
4
|
+
data.tar.gz: 72addcf3bc92a8bf5770134a079185d7fef7f9b3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a8098c9c5f614d736a19ff0abf170c5b5d8000dcec7585220f66687a73051a3fbf23053262e604890a69af7a2b17cba1cf0bd5bf2d698f47d0d2da3e681f77a3
|
7
|
+
data.tar.gz: e666fd9db47bee7413cb9a9b161c8b03d46671698e0ed10de2d4fd9b4329e15d24f88523332b9ba48dd4a7efc7a724cd1001bc598b6b602ac8716d1e14f2d26f
|
data/README.md
CHANGED
@@ -37,10 +37,10 @@ end
|
|
37
37
|
As this is a Faraday wrapper, the only thing that will change from normal Faraday usage is initialization.
|
38
38
|
|
39
39
|
```ruby
|
40
|
-
connection = We::Call::Connection.new(host: 'https://some-service.example.com/', timeout:
|
40
|
+
connection = We::Call::Connection.new(host: 'https://some-service.example.com/', timeout: 2)
|
41
41
|
|
42
42
|
# or with a Faraday connection block
|
43
|
-
connection = We::Call::Connection.new(host: 'https://some-service.example.com/', timeout:
|
43
|
+
connection = We::Call::Connection.new(host: 'https://some-service.example.com/', timeout: 2) do |conn|
|
44
44
|
conn.token_auth('abc123token')
|
45
45
|
conn.headers['Foo'] = 'bar'
|
46
46
|
end
|
@@ -61,7 +61,7 @@ connection = We::Call.configure do |config|
|
|
61
61
|
end
|
62
62
|
|
63
63
|
# Provided at initialization
|
64
|
-
connection = We::Call::Connection.new(host: 'https://service-b.example.com/', app: 'Service A', timeout:
|
64
|
+
connection = We::Call::Connection.new(host: 'https://service-b.example.com/', app: 'Service A', timeout: 2)
|
65
65
|
```
|
66
66
|
|
67
67
|
_Ofc services could lie about this, so do not use App Name for any sort of security. For that you need to use tokens assigned to applications. This is essentially just forcing a user agent._
|
@@ -75,7 +75,7 @@ connection = We::Call.configure do |config|
|
|
75
75
|
end
|
76
76
|
|
77
77
|
# Provided at initialization
|
78
|
-
connection = We::Call::Connection.new(host: 'https://service-b.example.com/', env: 'staging', timeout:
|
78
|
+
connection = We::Call::Connection.new(host: 'https://service-b.example.com/', env: 'staging', timeout: 2)
|
79
79
|
```
|
80
80
|
|
81
81
|
Not only is knowing the app name important, but knowing the env is necessary too. Sometimes people configure stuff wrong, and Service A (staging) will hit Service B (production) 😨.
|
@@ -90,12 +90,12 @@ The lower this number can be the better, as it reduces time web threads spend wa
|
|
90
90
|
|
91
91
|
```ruby
|
92
92
|
# Provided at initialization
|
93
|
-
connection = We::Call::Connection.new(host: 'https://service-b.example.com/', timeout:
|
93
|
+
connection = We::Call::Connection.new(host: 'https://service-b.example.com/', timeout: 2)
|
94
94
|
```
|
95
95
|
|
96
96
|
Timeouts can only be provided at initialization of a connection, as they should be different for each service. This is down to the sad reality that some internal services are more performant than others, and various third-parties will have different SLAs.
|
97
97
|
|
98
|
-
As well as `timeout: num_seconds` which can set the entire open/read (essentially the total response time of the server), another optional argument exists for `open_timeout: numseconds`. This is how long We::Call should spend waiting for a vague sign of life from the server, which by default is
|
98
|
+
As well as `timeout: num_seconds` which can set the entire open/read (essentially the total response time of the server), another optional argument exists for `open_timeout: numseconds`. This is how long We::Call should spend waiting for a vague sign of life from the server, which by default is 1.
|
99
99
|
|
100
100
|
### Deprecations
|
101
101
|
|
data/lib/we/call/connection.rb
CHANGED
@@ -1,6 +1,3 @@
|
|
1
|
-
require 'faraday'
|
2
|
-
require 'faraday-sunset'
|
3
|
-
require 'typhoeus'
|
4
1
|
require 'typhoeus/adapters/faraday'
|
5
2
|
|
6
3
|
module We
|
@@ -8,7 +5,9 @@ module We
|
|
8
5
|
module Connection
|
9
6
|
extend self
|
10
7
|
|
11
|
-
|
8
|
+
# If your network isn't stable enough to get a sign of life in 1s then you should look into that
|
9
|
+
# Or override this default on creating the connection.
|
10
|
+
OPEN_TIMEOUT = 1
|
12
11
|
|
13
12
|
# We use typhoeus instead of default NetHTTP so we can control how many retries are made
|
14
13
|
# https://github.com/lostisland/faraday/issues/612
|
data/lib/we/call/version.rb
CHANGED
data/lib/we/call.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: we-call
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.1.pre.alpha1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- WeWork Engineering
|
@@ -259,9 +259,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
259
259
|
version: '0'
|
260
260
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
261
261
|
requirements:
|
262
|
-
- - "
|
262
|
+
- - ">"
|
263
263
|
- !ruby/object:Gem::Version
|
264
|
-
version:
|
264
|
+
version: 1.3.1
|
265
265
|
requirements: []
|
266
266
|
rubyforge_project:
|
267
267
|
rubygems_version: 2.6.8
|