px-service-client 2.0.3 → 2.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/px/service/client/base.rb +9 -10
- data/lib/px/service/client/caching.rb +4 -4
- data/lib/px/service/client/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0c0de73dac7cba576f3d0e10fef5cae82a91c2d9
|
4
|
+
data.tar.gz: 422cce75ccf3d3232ad8d1594ae99b9d630168a9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8b1a9c65ad5721e50911751d6193c1f9f9865db0fddd278ea90421de4c12ec3f73233ec4fddd0f3a243aa9e26d60f5a399e5ae08246cf0af63b73aa11cd2757c
|
7
|
+
data.tar.gz: fe270fafd278f2db6a52c7a7134fd946df9e41a38fd305bfc46668d0726327f8dd83ad3ba29818a9a0e20d2044aa355c78b8aba412dc47a01093fcf48194a07f
|
@@ -40,20 +40,19 @@ module Px::Service::Client
|
|
40
40
|
|
41
41
|
##
|
42
42
|
# Make the request
|
43
|
-
def make_request(method, uri, query: nil, headers: nil, body: nil, timeout: 0)
|
44
|
-
|
45
|
-
"
|
46
|
-
]
|
47
|
-
|
48
|
-
|
49
|
-
|
43
|
+
def make_request(method, uri, query: nil, headers: nil, body: nil, timeout: 0, stats_tags: [])
|
44
|
+
_stats_tags = [
|
45
|
+
"remote_method:#{method.downcase}",
|
46
|
+
].concat(stats_tags)
|
47
|
+
|
48
|
+
if uri.respond_to?(:host)
|
49
|
+
_stats_tags << "remote_host:#{uri.host.downcase}"
|
50
50
|
else
|
51
51
|
actual_uri = URI(uri)
|
52
|
-
|
53
|
-
stats_tags << "path:#{actual_uri.path.gsub(/\d+/,'_')}"
|
52
|
+
_stats_tags << "remote_host:#{actual_uri.host.downcase}"
|
54
53
|
end
|
55
54
|
|
56
|
-
_make_request(method, uri, query: query, headers: headers, body: body, timeout: timeout, stats_tags:
|
55
|
+
_make_request(method, uri, query: query, headers: headers, body: body, timeout: timeout, stats_tags: _stats_tags)
|
57
56
|
end
|
58
57
|
|
59
58
|
def _make_request(method, uri, query: nil, headers: nil, body: nil, timeout: nil, stats_tags: [])
|
@@ -49,8 +49,8 @@ module Px::Service::Client
|
|
49
49
|
# returned and the cache entry is touched to prevent expiry. Otherwise, the original exception is re-raised.
|
50
50
|
def cache_last_resort(url, policy_group: 'general', expires_in: nil, refresh_probability: 1)
|
51
51
|
tags = [
|
52
|
-
"
|
53
|
-
"
|
52
|
+
"cache_type:last_resort",
|
53
|
+
"cache_policy_group:#{policy_group}",
|
54
54
|
]
|
55
55
|
|
56
56
|
# Note we use a smaller refresh window here (technically, could even use 0)
|
@@ -93,8 +93,8 @@ module Px::Service::Client
|
|
93
93
|
# cache_last_resort.
|
94
94
|
def cache_first_resort(url, policy_group: 'general', expires_in: nil)
|
95
95
|
tags = [
|
96
|
-
"
|
97
|
-
"
|
96
|
+
"cache_type:last_resort",
|
97
|
+
"cache_policy_group:#{policy_group}",
|
98
98
|
]
|
99
99
|
entry = CacheEntry.fetch(config.cache_client, url, policy_group)
|
100
100
|
|