rookout 0.1.25 → 0.1.26

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
  SHA256:
3
- metadata.gz: a2bdf85b56744c08bb1dbd03f5e877a1e5ff9408f10f7ebc496c90616630d782
4
- data.tar.gz: 8f8fd300f8ef303fb3f2ef136687ecb408aa490588af126d4ce0a6702932a948
3
+ metadata.gz: 71a48ffc9af42b9e823c1bb8511514e95954425a6ff43495b0f90f7defc98f9c
4
+ data.tar.gz: a525931c98fc3f8d23068f7d774a18c1b33b2edb756a1abea72a07efe8f2bef6
5
5
  SHA512:
6
- metadata.gz: 6e82f777a0498faee329e943cceed997111f1cb0ea75e9103294aac7b0cc53c4bd05d0af4060f748869159a1179586b0c8b0337b3652e83682f033fe2c3323a5
7
- data.tar.gz: a765e0817ae1d2959a90c6c13902b42bb02566b1d5c1a7932fb2ca044c1c3fd1ea5882804555dca0d9c2afd6052aaa52d2dc178323b19302f0ebe8b28a25a1e2
6
+ metadata.gz: b7fac6cf5a613e6dc45c6071d5c6f6e133568911fa1ee6a66e17e50e22c61523dcd0706c1126ea8390320137e44ca832cb78946c4c57c2608fee0b4d590755b2
7
+ data.tar.gz: baad1dcec8ec04456aeb993825e36b5025d9c901aaf56970709b51801b55e397f25be02e14153a31978433f8127576e02484af4cdfcb4f34229a22463524669a
@@ -30,7 +30,6 @@ module Rookout
30
30
  @mutex.synchronize do
31
31
  # Clean old windows
32
32
  cleanup now_ns
33
-
34
33
  # Increase active count
35
34
  @active_count += 1
36
35
  active = true
@@ -58,6 +57,8 @@ module Rookout
58
57
 
59
58
  private
60
59
 
60
+ attr_reader :windows # will be used only in tests using <OBJ>.send(:windows)
61
+
61
62
  def timestamp_to_window_keys now_ns
62
63
  current_window_key = (now_ns / @window_size) * @window_size
63
64
  prev_window_key = current_window_key - @window_size
@@ -90,15 +91,7 @@ module Rookout
90
91
  end
91
92
 
92
93
  def cleanup now_ns
93
- # Don't bother with contention
94
- return if @mutex.locked?
95
-
96
- @mutex.synchronize do
97
- # every 5 windows-times, clear windows older than 10 window-times
98
- if @windows.length > 10
99
- @windows.reject! { |key, _| key < (now_ns - @window_size * 5) }
100
- end
101
- end
94
+ @windows.reject! { |key, _| key < (now_ns - @window_size * 5) } if @windows.length > 10
102
95
  end
103
96
  end
104
97
  end
@@ -1,3 +1,3 @@
1
1
  module Rookout
2
- COMMIT = "940d70afca76883c64c4a1e2892bfbca591e9cee".freeze
2
+ COMMIT = "5dbaa8024d9dd61fbf97ca654094c5c30728d4f9".freeze
3
3
  end
@@ -1,3 +1,3 @@
1
1
  module Rookout
2
- VERSION = "0.1.25".freeze
2
+ VERSION = "0.1.26".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rookout
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.25
4
+ version: 0.1.26
5
5
  platform: ruby
6
6
  authors:
7
7
  - Liran Haimovitch
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-08-26 00:00:00.000000000 Z
11
+ date: 2021-09-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: binding_of_caller