semian 0.11.4 → 0.11.5

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: c988cdfecca00a6df20c29238464aa7abf607ff59064612015616b38a69e8ac0
4
- data.tar.gz: 52682cddc76221d7e09c4d6e9c1074754afc2c648fcb7f19ffea05dfaff9a8f1
3
+ metadata.gz: c0651ee42cbac47393177d1c80e6903e61dd226ce0da0adf57ee720c687bd2a0
4
+ data.tar.gz: 844843bbf8c005b4dae38529f2b51f16246c3c64b6e31e94648c3e4c3303f74c
5
5
  SHA512:
6
- metadata.gz: e4c6a0b2e33e13abc45641774b7d79faf5bec85241a5704cb1cd9180be5ee99b726b769bf9bf64d77528584fe13b9b875f92c4a04d4f0ef32dd0f1875ee1b3c9
7
- data.tar.gz: 75a3f87b1986daac3d4f4528aea225ff30c02637b693c668f6bd799506193c3d4517327f20a194b9251412a8c7c6322b8343656867b64407f22459c93e6dc8e2
6
+ metadata.gz: c680195c4c8738df4bf06c71264f37a1a182dc680ae9186834872cac9ebd75949d5cc66ca839f199afbaf1cbf45c11d65d76b34a27717dbbd85962be23594753
7
+ data.tar.gz: e630c03e61c1224661cae64c6ebcaf0e5a706ae08262fa4659054519216c849a6de5b2777ca4069e76a5e87bad2c740125e10138e58034e2d734b16e52f481cc
@@ -272,8 +272,11 @@ check_permissions_arg(VALUE permissions)
272
272
  static void
273
273
  check_tickets_xor_quota_arg(VALUE tickets, VALUE quota)
274
274
  {
275
- if ((TYPE(tickets) == T_NIL && TYPE(quota) == T_NIL) ||(TYPE(tickets) != T_NIL && TYPE(quota) != T_NIL)){
276
- rb_raise(rb_eArgError, "Must pass exactly one of ticket or quota");
275
+ if (tickets == Qnil && quota == Qnil) {
276
+ rb_raise(rb_eArgError, "Semian configuration require either the :ticket or :quota parameter, you provided neither");
277
+ }
278
+ if (tickets != Qnil && quota != Qnil) {
279
+ rb_raise(rb_eArgError, "Semian configuration require either the :ticket or :quota parameter, you provided both");
277
280
  }
278
281
  }
279
282
 
@@ -61,6 +61,11 @@ module Semian
61
61
  end
62
62
  end
63
63
 
64
+ def initialize(*args, semian: true)
65
+ super(*args)
66
+ @semian_enabled = semian
67
+ end
68
+
64
69
  Semian::NetHTTP.reset_exceptions
65
70
 
66
71
  def raw_semian_options
@@ -75,7 +80,7 @@ module Semian
75
80
  end
76
81
 
77
82
  def disabled?
78
- raw_semian_options.nil?
83
+ raw_semian_options.nil? || @semian_enabled == false
79
84
  end
80
85
 
81
86
  def connect
@@ -1,3 +1,3 @@
1
1
  module Semian
2
- VERSION = '0.11.4'
2
+ VERSION = '0.11.5'
3
3
  end
data/lib/semian.rb CHANGED
@@ -46,7 +46,7 @@ require 'semian/lru_hash'
46
46
  # resource the time to recover. If `error_threshold` errors happen in the span of `error_timeout`
47
47
  # then the circuit will be opened and every attempt to acquire the resource will immediately fail.
48
48
  #
49
- # Once in open state, after `error_timeout` is elapsed, the ciruit will transition in the half-open state.
49
+ # Once in open state, after `error_timeout` is elapsed, the circuit will transition in the half-open state.
50
50
  # In that state a single error will fully re-open the circuit, and the circuit will transition back to the closed
51
51
  # state only after the resource is acquired `success_threshold` consecutive times.
52
52
  #
@@ -62,7 +62,7 @@ require 'semian/lru_hash'
62
62
  #
63
63
  # After 3 failures in the span of 10 seconds the circuit will be open.
64
64
  # After an additional 10 seconds it will transition to half-open.
65
- # And finally after 2 successulf acquisitions of the resource it will transition back to the closed state.
65
+ # And finally after 2 successful acquisitions of the resource it will transition back to the closed state.
66
66
  #
67
67
  # ===== Using a resource
68
68
  #
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: semian
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.4
4
+ version: 0.11.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Scott Francis
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2021-04-01 00:00:00.000000000 Z
13
+ date: 2021-11-30 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rake-compiler
@@ -251,7 +251,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
251
251
  - !ruby/object:Gem::Version
252
252
  version: '0'
253
253
  requirements: []
254
- rubygems_version: 3.0.3
254
+ rubygems_version: 3.2.20
255
255
  signing_key:
256
256
  specification_version: 4
257
257
  summary: Bulkheading for Ruby with SysV semaphores