lhc 10.4.1 → 10.4.2

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: 4c18e4ba62e228e3e5dc6e2650e328affdff5313678727e4e67bf1227e1cca81
4
- data.tar.gz: b025952c55e322767e53974021e13a481eee200f675ed1de766f2bdd50f79e83
3
+ metadata.gz: e1d081bbe01eadc3a60d41068a65bb5b5f5e8d8d44547e8c076b8e0e5f72307d
4
+ data.tar.gz: e0c41de69f16e1146aa28227a67cebd278a6f203439bdd737aff1d8247522d2f
5
5
  SHA512:
6
- metadata.gz: 6388cce68e50d90d10cd90b4c5a6421a0ae2515e73a4f473c4507d9a0136bd1ab724e4fbee0aefd52035e26cdb904504d788a4c8477b0e13aecf0cefd2ba87e9
7
- data.tar.gz: fc9cd894ed6becd43043bf25ccdef204a4fb1028f7c7ec10b412dd445672f843211f7b912bd47082c13e02b515c2c989a7082003754f0ffb8e0f87eefb8862c2
6
+ metadata.gz: cfaafff18eea78de74559bc8d866be1d9bcc3666d69bd0ee9ed4eefc8da80b9a962a32e134dc1603299481ab1768f0f44f89b0154652ba2764faa9a08eb29e96
7
+ data.tar.gz: 74f4d0d051992fe02bdb31bafa8291b002466981430ad118b89fab189334ff6824864ead2021f86a0c967d7097e3809e75d1ad69e3e83d0f423099929e3b452a
@@ -33,7 +33,7 @@ class LHC::Throttle < LHC::Interceptor
33
33
  def break_when_quota_reached!
34
34
  options = request.options.dig(:throttle)
35
35
  track = (self.class.track || {}).dig(options[:provider])
36
- return unless track
36
+ return if track.blank? || track[:remaining].blank? || track[:limit].blank?
37
37
  # avoid floats by multiplying with 100
38
38
  remaining = track[:remaining] * 100
39
39
  limit = track[:limit]
data/lib/lhc/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module LHC
4
- VERSION ||= '10.4.1'
4
+ VERSION ||= '10.4.2'
5
5
  end
@@ -77,5 +77,14 @@ describe LHC::Throttle do
77
77
  it 'does not raise an exception' do
78
78
  LHC.get('http://local.ch', options)
79
79
  end
80
+
81
+ context 'no remaining tracked, but break enabled' do
82
+ let(:break_option) { '90%' }
83
+
84
+ it 'does not fail if a remaining was not tracked yet' do
85
+ LHC.get('http://local.ch', options)
86
+ LHC.get('http://local.ch', options)
87
+ end
88
+ end
80
89
  end
81
90
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lhc
3
3
  version: !ruby/object:Gem::Version
4
- version: 10.4.1
4
+ version: 10.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - https://github.com/local-ch/lhc/contributors