litmus_paper 1.4.1 → 1.4.2

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
  SHA1:
3
- metadata.gz: 81d5bca1668f1457cd9c766f4e5213ea2867921d
4
- data.tar.gz: d6c0158e8d8895dcd00e8af89183900a022613f4
3
+ metadata.gz: 05ab0a2d2bdf985757966671d62f5394d050cf23
4
+ data.tar.gz: 783dd54f751a15260583508c38d4cfb1cf67c8ec
5
5
  SHA512:
6
- metadata.gz: 843f555781fd9e5c2c9f28289322a18e44bfef87bcb680c563f86f3745e1bd943a84ef99d61e053339469821c8dfed2a433a229ff388b61d2bef2dab7202966c
7
- data.tar.gz: 4fa41594e74cf755f2e5119a68861c47c3503b5bd2d0bd6c50280df6bbc2fbfaf7c89bdd3ac09eda09e7f1b47ba1f3868c7078d0f471da18baec45b0ba0e2359
6
+ metadata.gz: 3f0188ded625a2605a3da4bba95866517469f713400ff38372c1ffbd26924e2c356af26067207719383fa48562da7605004a452b2a1add0cb486afa96e7b03b7
7
+ data.tar.gz: 62e49cdad532162054aa364acb84af933c5d4254f54eccb638f32283244e1973c42e2212ef6043ba6780f1c64167f597b8e518f552fed7550ffca9b4ef1187bc
@@ -7,17 +7,21 @@ module LitmusPaper
7
7
  @weight = weight
8
8
  @socket_path = socket_path
9
9
  @maxconn = maxconn
10
+ @active = 0
11
+ @queued = 0
10
12
  end
11
13
 
12
14
  def current_health
13
15
  stats = _stats
14
- if stats.queued == 0
16
+ @active = stats.active
17
+ @queued = stats.queued
18
+ if @queued == 0
15
19
  return @weight
16
20
  else
17
21
  return [
18
22
  @weight - (
19
- (@weight * _stats.active.to_f) / (3 * @maxconn.to_f) +
20
- (2 * @weight * _stats.queued.to_f) / (3 * @maxconn.to_f)
23
+ (@weight * @active.to_f) / (3 * @maxconn.to_f) +
24
+ (2 * @weight * @queued.to_f) / (3 * @maxconn.to_f)
21
25
  ), 1
22
26
  ].max
23
27
  end
@@ -28,7 +32,7 @@ module LitmusPaper
28
32
  end
29
33
 
30
34
  def to_s
31
- "Metric::UnixSocketUtilitization(weight: #{@weight}, maxconn: #{@maxconn}, path: #{@socket_path})"
35
+ "Metric::UnixSocketUtilitization(weight: #{@weight}, maxconn: #{@maxconn}, active: #{@active.to_i}, queued: #{@queued.to_i}, path: #{@socket_path})"
32
36
  end
33
37
  end
34
38
  end
@@ -1,3 +1,3 @@
1
1
  module LitmusPaper
2
- VERSION = "1.4.1"
2
+ VERSION = "1.4.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: litmus_paper
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.1
4
+ version: 1.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Braintreeps
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-11-01 00:00:00.000000000 Z
11
+ date: 2019-05-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sinatra