semian 0.14.0 → 0.15.0

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: a7b62deafc4e8de524ae8aec32a17e3a1065d70206a5ead2ef6298da3b1c38ed
4
- data.tar.gz: 3f6b18aa473410c0ad8d476931417fa69595328fd748a2edb75a333709b901cd
3
+ metadata.gz: 9610bcda3bdfb95c885c6c31c4a2450a4c31824f877ad38e7ca3c34c4fd57d6c
4
+ data.tar.gz: d748c2da29ba2ca844bc74354591196a6645a915d725fea07ab743d0b6343bf2
5
5
  SHA512:
6
- metadata.gz: c064829103c0c4f8915f6c072d43872b9a6dc011987e6a81f5efa8931052cc84b758df9bc4dd74f4f90c0501accbaa3e09ca3212af6a8a3e7056ce1f28a28e22
7
- data.tar.gz: 124128fc2a5791317ea5a04b32c84e9b3cd394e843a74599c5ecf044cc6c89eec656384675b88e9fd73e95038dfb1e8a35b8e613034114e264b59e754a8eec0c
6
+ metadata.gz: bf3e8a28916019f60f64ce668cd919e4b59e3ebcb50e397266363b7f43d093cbefd06bb41b9816351b9435484b5948eaf5c45e5408d677d76c0ac879ae98b21e
7
+ data.tar.gz: b387b82d92712aba64d47e0a8ac33abc9789dba435e88e0020de6eae46881938fcdba5f16da39cbc3930e8a8e9b4bdacf3688388c9d328be25845915b341a5ce
data/README.md CHANGED
@@ -531,7 +531,7 @@ provides an easy way to get the semaphore key:
531
531
 
532
532
  ```
533
533
  irb> require 'semian'
534
- irb> puts Semian::Resource.new(:your_resource_name, tickets:1).key # do this from a dev machine
534
+ irb> puts Semian::Resource.new(:your_resource_name, tickets: 42).key # do this from a dev machine
535
535
  "0x48af51ea"
536
536
  ```
537
537
 
@@ -553,8 +553,8 @@ otime = Thu Mar 30 15:06:16 2017
553
553
  ctime = Mon Mar 13 20:25:36 2017
554
554
  semnum value ncount zcount pid
555
555
  0 1 0 0 48
556
- 1 25 0 0 48
557
- 2 25 0 0 27
556
+ 1 42 0 0 48
557
+ 2 42 0 0 27
558
558
  3 31 0 0 48
559
559
  ```
560
560
 
data/lib/semian/mysql2.rb CHANGED
@@ -70,6 +70,8 @@ module Semian
70
70
  end
71
71
 
72
72
  def ping
73
+ return false if closed?
74
+
73
75
  result = nil
74
76
  acquire_semian_resource(adapter: :mysql, scope: :ping) do
75
77
  result = raw_ping
data/lib/semian/rails.rb CHANGED
@@ -4,6 +4,23 @@ require "active_record/connection_adapters/abstract_adapter"
4
4
 
5
5
  module Semian
6
6
  module Rails
7
+ extend ActiveSupport::Concern
8
+
9
+ module ClassMethods
10
+ # Translate ConnectionNotEstablished errors to their original
11
+ # cause if applicable. When we have a CircuitOpenErorr we don't
12
+ # want the Active Record error, but rather the original cause.
13
+ def new_client(config)
14
+ super
15
+ rescue ActiveRecord::ConnectionNotEstablished => e
16
+ if e.cause.is_a?(Mysql2::CircuitOpenError)
17
+ raise e.cause
18
+ else
19
+ raise
20
+ end
21
+ end
22
+ end
23
+
7
24
  def semian_resource
8
25
  @semian_resource ||= client_connection.semian_resource
9
26
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Semian
4
- VERSION = "0.14.0"
4
+ VERSION = "0.15.0"
5
5
  end
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.14.0
4
+ version: 0.15.0
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: 2022-09-07 00:00:00.000000000 Z
13
+ date: 2022-09-12 00:00:00.000000000 Z
14
14
  dependencies: []
15
15
  description: |2
16
16
  A Ruby C extention that is used to control access to shared resources