rookout 0.1.51 → 0.1.52

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: b71e6bd18d01e029f8cf4af94972d381ba85e009c585faaefa68bc3a92a02760
4
- data.tar.gz: 271feda072ee3e05830a9546c75c55c2c6972f61bc9adefd2391d53ffc39d533
3
+ metadata.gz: 8854b65da599e09232b62dadbe87cb092dccd93e2a3153dae13e5aa703fcd4e0
4
+ data.tar.gz: 8fb0f255e23b6eac93f293632a4230e7b24fa80fcdd49d0288d78582ebd121e0
5
5
  SHA512:
6
- metadata.gz: e0d3e4756e6ffeae753cb793b192ddaf14cb23bfce6e3e9ffb1685a88f12afb03fb2fc4dbc7cc3d419f03d34c288166da3b18baa01ce402bcc694f261605ce28
7
- data.tar.gz: 72f0f299569c7b88de968c91b35df48248bb9430c8c1166db662e305ab069c80f7d85366815f05d8ad15f35c1daea5fd5e51ae777202e2f4a3a4019174f0a515
6
+ metadata.gz: a0008b3f484e1967418b7cd8bd9db5b8550658a1eb211b5f1ce6f6e731a9fca6733361fd03413f1904dd2aebea889be20418b5fcde963ffd14d116290e8421cf
7
+ data.tar.gz: 3d2282c21829a747f961e6063435433aa19e88be46ae3f572c8239355ef6dfda585fd12c8d12c4b401d427d7fd0f9040c744b0c27a673b2d9a87a0ac6705ca56
@@ -48,7 +48,9 @@ module Rookout
48
48
  if @has_quota
49
49
  now_ns = Utils.time_to_nanoseconds start_time
50
50
  current_window_key, = timestamp_to_window_keys now_ns
51
- @mutex.synchronize { record_usage current_window_key, Utils.time_to_nanoseconds(Time.now) - now_ns }
51
+ time_used = Utils.time_to_nanoseconds(Time.now) - now_ns
52
+ time_recorded = time_used > Config.min_rate_limit_value_ns ? time_used : Config.min_rate_limit_value_ns
53
+ @mutex.synchronize { record_usage current_window_key, time_recorded }
52
54
  end
53
55
  # Reduce active count
54
56
  @mutex.synchronize { @active_count -= 1 }
@@ -1,3 +1,3 @@
1
1
  module Rookout
2
- COMMIT = "4b7d93d4ac54fdb125814b01e8e56e183b42a581".freeze
2
+ COMMIT = "3e5cbb5882385eff12a3113f93dfde79418d5061".freeze
3
3
  end
@@ -82,11 +82,13 @@ module Rookout
82
82
  attr_accessor :global_rate_limit_window_size
83
83
  attr_accessor :global_rate_limit
84
84
  attr_accessor :using_global_rate_limiter
85
+ attr_accessor :min_rate_limit_value_ns
85
86
 
86
87
  Rookout::Config.global_rate_limit_quota = ""
87
88
  Rookout::Config.global_rate_limit_window_size = ""
88
89
  Rookout::Config.global_rate_limit = ""
89
90
  Rookout::Config.using_global_rate_limiter = false
91
+ Rookout::Config.min_rate_limit_value_ns = 125 * 1000
90
92
 
91
93
  def update_config configuration
92
94
  update_var2_config configuration
@@ -1,3 +1,3 @@
1
1
  module Rookout
2
- VERSION = "0.1.51".freeze
2
+ VERSION = "0.1.52".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.51
4
+ version: 0.1.52
5
5
  platform: ruby
6
6
  authors:
7
7
  - Liran Haimovitch
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-02-16 00:00:00.000000000 Z
11
+ date: 2023-02-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: binding_of_caller