rate_limit-htb 0.1.0 → 0.1.1

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
  SHA1:
3
- metadata.gz: 130ddde0f1a336c53bab0089fb2d0355a7f38f16
4
- data.tar.gz: ce908f450073260e47d55e377dbfe2b76960bc79
3
+ metadata.gz: '093b0c2494faa00447a189c53ada0a6d2d3ded74'
4
+ data.tar.gz: b24d7b92107c7889a6d0e7ae0688d9b4eae4a410
5
5
  SHA512:
6
- metadata.gz: 0024efa388d90fd228c308d4bb61251e76d4c26385d7cf741de53991fd3cbd7d4b0982a798d7fd191662412196c4b3ba92378cb6cd05a8504034dc9648acdccc
7
- data.tar.gz: c6661bfc9b20e2f0368633e090609020904a43516b7553e344aa3187ea7b70401dc73c1e3e83f70cdafc5e6b1aac40b5efec548dd92e269afe345a3213e106bb
6
+ metadata.gz: 4d50ea8b4df23a088a1fc0f1df4a2b2efef09b60007a0bfd3445711399b0ef11d7bb9c245191544920f18e4393526f448a752dbee52e82fcdf8de830e74a7daf
7
+ data.tar.gz: 68fcf7029d1302aefd6a6b18becf1874105e7b2391b7722f22f012dc042abe8847d660231754285fb956e849ee6e87a1be385be5078d64585fa2ebb0596cd988
@@ -53,7 +53,7 @@ module RateLimit
53
53
  #
54
54
  def initialize(rate, parent = nil)
55
55
  @lock = Monitor.new
56
- @rate = rate
56
+ @rate = rate || 0
57
57
  @bucket_size = rate
58
58
  @parent = parent
59
59
  @tokens = rate
@@ -87,8 +87,8 @@ module RateLimit
87
87
  # Try to take amount tokens from this bucket or wait for the tokens to replenish
88
88
  # do this until we could get the amount of tokens we wanted
89
89
  until take amount
90
- duration = amount.to_f / @rate
91
- puts "sleeping for #{duration}"
90
+ duration = amount.to_f / rate # rate is a method
91
+ #puts "sleeping for #{duration}"
92
92
  sleep duration
93
93
  end
94
94
  end
@@ -1,5 +1,5 @@
1
1
  module RateLimit
2
2
  module Htb
3
- VERSION = "0.1.0"
3
+ VERSION = "0.1.1"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rate_limit-htb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dominic Althaus
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-06-20 00:00:00.000000000 Z
11
+ date: 2018-06-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler