semian 0.25.5 → 0.26.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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/semian/version.rb +1 -1
  3. data/lib/semian.rb +19 -6
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7a367c10d728005041ed53354fcd0277fb2b77165abbc908624e8f25428ac3a3
4
- data.tar.gz: f41150be77f1125251a6440de9c3b999d23fb599f520f79829d90b243c33d339
3
+ metadata.gz: 20f2ab860d074c5420db9d4a5ec675307fdf046c4ad06d3aab227273b7a3716c
4
+ data.tar.gz: 25e865fa1a72948765a572a20ccfbdea783c4940fd245bf18f281af8a2351f54
5
5
  SHA512:
6
- metadata.gz: eca3ce48c96d84633d07a0612b15e23ee4e0694344ca135b19425fe6021a825c8685966ea295b02de58378af3c5e9f0e6d818229f3b3830e3b5fc7c8a9fb232c
7
- data.tar.gz: ffa1c7ab62ec4e31a2657e9159fbb048bd439437cf5f30fa2eae0366f4aa196596f106212fba2a3739a4301952962a78baebc32882fd8fd0b2ad5bc4ab7dbf9f
6
+ metadata.gz: f8dbe833518cadd4083cb104554add1f1e0b506d02f92b8b55dbc763ff822e5e5fdf22633b3de415fde54ba56780c5ea2e2aae88bd08d7367d5fa5e10ea58d33
7
+ data.tar.gz: a126b289713f04a264a7a8e24e25fa1b7cd964477a22ec5f62696710c79abb9f6e73c74ef71ed77e7d05665d79ea67b53bc598d0c8b2a837eef8f8a75b608e71
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Semian
4
- VERSION = "0.25.5"
4
+ VERSION = "0.26.5"
5
5
  end
data/lib/semian.rb CHANGED
@@ -104,7 +104,7 @@ module Semian
104
104
  OpenCircuitError = Class.new(BaseError)
105
105
  SemaphoreMissingError = Class.new(BaseError)
106
106
 
107
- attr_accessor :maximum_lru_size, :minimum_lru_time, :default_permissions, :namespace, :default_force_config_validation, :resources, :consumers
107
+ attr_accessor :maximum_lru_size, :minimum_lru_time, :default_permissions, :namespace, :default_force_config_validation
108
108
 
109
109
  self.maximum_lru_size = 500
110
110
  self.minimum_lru_time = 300 # 300 seconds / 5 minutes
@@ -123,9 +123,6 @@ module Semian
123
123
  @thread_safe = thread_safe
124
124
  end
125
125
 
126
- self.resources = LRUHash.new
127
- self.consumers = Concurrent::Map.new
128
-
129
126
  @reset_mutex = Mutex.new
130
127
 
131
128
  def issue_disabled_semaphores_warning
@@ -265,8 +262,8 @@ module Semian
265
262
 
266
263
  def reset!
267
264
  @reset_mutex.synchronize do
268
- self.consumers = Concurrent::Map.new
269
- self.resources = LRUHash.new
265
+ @consumers = Concurrent::Map.new
266
+ @resources = LRUHash.new
270
267
  end
271
268
  end
272
269
 
@@ -285,6 +282,22 @@ module Semian
285
282
  thread.thread_variable_set(THREAD_BULKHEAD_DISABLED_VAR, old_value)
286
283
  end
287
284
 
285
+ def resources
286
+ return @resources if defined?(@resources) && @resources
287
+
288
+ @reset_mutex.synchronize do
289
+ @resources ||= LRUHash.new
290
+ end
291
+ end
292
+
293
+ def consumers
294
+ return @consumers if defined?(@consumers) && @consumers
295
+
296
+ @reset_mutex.synchronize do
297
+ @consumers ||= Concurrent::Map.new
298
+ end
299
+ end
300
+
288
301
  private
289
302
 
290
303
  def create_circuit_breaker(name, **options)
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.25.5
4
+ version: 0.26.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Scott Francis