ezclient 1.5.0 → 1.5.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c4f9418b8f7468e16261c321cf17ea9ee34e8c2168fda6b936a56b8c88db20ad
4
- data.tar.gz: a82af3a1afcd6baa5cdc8e04521db679670b854631843fe3171714f3f4900488
3
+ metadata.gz: 9a7c441970d24a2206c3cd0f2f93ed5cbecb592ae8344d6a7ba449dd3d0b16f6
4
+ data.tar.gz: '049c93b96e988fc0e2898161e87ff1b8cadb6282c4deb2a88d34f00ffc2cccb0'
5
5
  SHA512:
6
- metadata.gz: b0c28a22832ce80a471d1fa16483fb0fcbab35550879e8132b6ee4849633489ce49cac1c03dc377ee0936033c9db9d144892644a598313e6d6a20efbf8eda5e4
7
- data.tar.gz: 60fc3ff9026c5984d9548a9f420e65d7c3bd223efb29fd96daafbbcb3d725ac3ddd680d94d3121a60fe5b0a21c9ea8d08fa14128ca6883305e921a151360f270
6
+ metadata.gz: 6b5a1fb31992687e9bf84f10cc1bdd4fc34b84672ce7a3e6f097778f2e07a0b8516f7c82d8a55e655dd85a7cf24de6b92484c5d7c0165f2408bcf3309ce60808
7
+ data.tar.gz: e3a4e0dde38f1da48c7d18c330014e14275853cacd7e3b693ab58b5ac6735524a89d081c818f56def176a06bde8ba1714a2d0f5b4de24c4c3daac3792e59f396
@@ -5,8 +5,6 @@ class EzClient::PersistentClient
5
5
 
6
6
  def_delegators :http_client, :build_request, :default_options, :timeout
7
7
 
8
- attr_accessor :origin, :keep_alive_timeout, :last_request_at
9
-
10
8
  def initialize(origin, keep_alive_timeout)
11
9
  self.origin = origin
12
10
  self.keep_alive_timeout = keep_alive_timeout
@@ -19,8 +17,14 @@ class EzClient::PersistentClient
19
17
  end
20
18
  end
21
19
 
20
+ def timed_out?
21
+ last_request_at && EzClient.get_time - last_request_at >= keep_alive_timeout
22
+ end
23
+
22
24
  private
23
25
 
26
+ attr_accessor :origin, :keep_alive_timeout, :last_request_at
27
+
24
28
  def http_client
25
29
  @http_client ||= HTTP.persistent(origin, timeout: keep_alive_timeout)
26
30
  end
@@ -16,8 +16,6 @@ class EzClient::PersistentClientRegistry
16
16
  attr_accessor :registry
17
17
 
18
18
  def cleanup_registry!
19
- registry.delete_if do |_key, value|
20
- EzClient.get_time - value.last_request_at >= value.keep_alive_timeout
21
- end
19
+ registry.delete_if { |_origin, client| client.timed_out? }
22
20
  end
23
21
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EzClient
4
- VERSION = "1.5.0"
4
+ VERSION = "1.5.1"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ezclient
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.0
4
+ version: 1.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yuri Smirnov