semian 0.25.5 → 0.26.6

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: 7a367c10d728005041ed53354fcd0277fb2b77165abbc908624e8f25428ac3a3
4
- data.tar.gz: f41150be77f1125251a6440de9c3b999d23fb599f520f79829d90b243c33d339
3
+ metadata.gz: c745b1aaf79e752138bf6cbfcff3e218022dfbaac8b3f6adba3dd9bd4091bbee
4
+ data.tar.gz: 03e8d192ffd5e7b86aadb3b87ad9846e4d0cc18724d67a14e72c35949a11e3f6
5
5
  SHA512:
6
- metadata.gz: eca3ce48c96d84633d07a0612b15e23ee4e0694344ca135b19425fe6021a825c8685966ea295b02de58378af3c5e9f0e6d818229f3b3830e3b5fc7c8a9fb232c
7
- data.tar.gz: ffa1c7ab62ec4e31a2657e9159fbb048bd439437cf5f30fa2eae0366f4aa196596f106212fba2a3739a4301952962a78baebc32882fd8fd0b2ad5bc4ab7dbf9f
6
+ metadata.gz: afa858cd11acdf8047f6dd38850419927915ff87b6dfeabd820ffa888b269aafc67415cce0a85543e3d49562b733a01ea8b22fd46c6b5fc24374236a333cf0ef
7
+ data.tar.gz: 9a087827f9abaefa6bdcdda853b3423e9a19fe9e0b6a35c2cea8650266857713ffeea39136560a6ed1f763940ff9f28868bcbb9e95aa84cac91764229cb2dfdb
@@ -7,12 +7,6 @@ module Semian
7
7
  @configuration = configuration
8
8
  @adapter = configuration[:adapter]
9
9
  @force_config_validation = force_config_validation?
10
-
11
- unless @force_config_validation
12
- Semian.logger.info(
13
- "Semian Resource #{@name} is running in log-mode for configuration validation. This means that Semian will not raise an error if the configuration is invalid. This is not recommended for production environments.\n\n[IMPORTANT] PLEASE UPDATE YOUR CONFIGURATION TO USE `force_config_validation: true` TO ENABLE STRICT CONFIGURATION VALIDATION.\n---\n",
14
- )
15
- end
16
10
  end
17
11
 
18
12
  def validate!
@@ -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.6"
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.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Scott Francis
@@ -10,7 +10,21 @@ authors:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
  date: 1980-01-02 00:00:00.000000000 Z
13
- dependencies: []
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: concurrent-ruby
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - ">="
19
+ - !ruby/object:Gem::Version
20
+ version: '0'
21
+ type: :runtime
22
+ prerelease: false
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - ">="
26
+ - !ruby/object:Gem::Version
27
+ version: '0'
14
28
  description: |2
15
29
  A Ruby C extention that is used to control access to shared resources
16
30
  across process boundaries with SysV semaphores.