semian 0.21.3 → 0.22.0.RC.1
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 +4 -4
- data/ext/semian/resource.c +2 -0
- data/ext/semian/semian.c +12 -1
- data/ext/semian/sysv_semaphores.h +1 -1
- data/lib/semian/mysql2.rb +4 -1
- data/lib/semian/redis.rb +2 -1
- data/lib/semian/redis_client.rb +9 -3
- data/lib/semian/version.rb +1 -1
- data/lib/semian.rb +1 -0
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: afd87705b68966cef884eeeb1d5df4d052eeb86f2ff7d43c9499435795341461
|
4
|
+
data.tar.gz: 911a0772662b81e21dcb475c9b981ceb0fbaeadf26edbbca70ab8adbf5be4068
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8edb70d967cb15e12b919b3a7e6585f98848e2d569683d590d2d37e32eb57b65cd9f425931a3bf1575d91fc6c50e9d43901340cb33a34a671a585956b947514f
|
7
|
+
data.tar.gz: b880f4f52891cbc4fd3d97221053bddc741aa72a98b986826b8ca08454c73ccbe714cff311966387f40b83e2f48a6d2db4ddf23407ff275e55bfb8c1730b5673
|
data/ext/semian/resource.c
CHANGED
@@ -63,6 +63,8 @@ semian_resource_acquire(int argc, VALUE *argv, VALUE self)
|
|
63
63
|
if (res.error != 0) {
|
64
64
|
if (res.error == EAGAIN) {
|
65
65
|
rb_raise(eTimeout, "timed out waiting for resource '%s'", res.name);
|
66
|
+
} else if (res.error == EINVAL && get_semaphore(res.sem_id) == -1 && errno == ENOENT) {
|
67
|
+
rb_raise(eSemaphoreMissing, "semaphore array '%s' no longer exists", res.name);
|
66
68
|
} else {
|
67
69
|
raise_semian_syscall_error("semop()", res.error);
|
68
70
|
}
|
data/ext/semian/semian.c
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
#include "semian.h"
|
2
2
|
|
3
|
-
VALUE eSyscall, eTimeout, eInternal;
|
3
|
+
VALUE eSyscall, eTimeout, eInternal, eSemaphoreMissing;
|
4
4
|
|
5
5
|
void Init_semian()
|
6
6
|
{
|
@@ -46,6 +46,17 @@ void Init_semian()
|
|
46
46
|
eInternal = rb_const_get(cSemian, rb_intern("InternalError"));
|
47
47
|
rb_global_variable(&eInternal);
|
48
48
|
|
49
|
+
/* Document-class: Semian::SemaphoreMissingError
|
50
|
+
*
|
51
|
+
* Indicates that some time after initialization, a semaphore array was no longer
|
52
|
+
* present when we tried to access it. This can happen because semaphores were
|
53
|
+
* deleted using the <code>ipcrm</code> command line tool, the
|
54
|
+
* <code>semctl(..., IPC_RMID)</code> syscall, or systemd's <code>RemoveIPC</code>
|
55
|
+
* feature.
|
56
|
+
*/
|
57
|
+
eSemaphoreMissing = rb_const_get(cSemian, rb_intern("SemaphoreMissingError"));
|
58
|
+
rb_global_variable(&eSemaphoreMissing);
|
59
|
+
|
49
60
|
rb_define_alloc_func(cResource, semian_resource_alloc);
|
50
61
|
rb_define_method(cResource, "initialize_semaphore", semian_resource_initialize, 5);
|
51
62
|
rb_define_method(cResource, "acquire", semian_resource_acquire, -1);
|
data/lib/semian/mysql2.rb
CHANGED
@@ -28,6 +28,8 @@ module Semian
|
|
28
28
|
/Too many connections/i,
|
29
29
|
/closed MySQL connection/i,
|
30
30
|
/Timeout waiting for a response/i,
|
31
|
+
/No matching servers with free connections/i,
|
32
|
+
/Max connect timeout reached while reaching hostgroup/i,
|
31
33
|
)
|
32
34
|
|
33
35
|
ResourceBusyError = ::Mysql2::ResourceBusyError
|
@@ -136,7 +138,8 @@ module Semian
|
|
136
138
|
|
137
139
|
def raw_semian_options
|
138
140
|
return query_options[:semian] if query_options.key?(:semian)
|
139
|
-
|
141
|
+
|
142
|
+
query_options["semian"] if query_options.key?("semian")
|
140
143
|
end
|
141
144
|
end
|
142
145
|
end
|
data/lib/semian/redis.rb
CHANGED
@@ -151,7 +151,8 @@ module Semian
|
|
151
151
|
|
152
152
|
def raw_semian_options
|
153
153
|
return options[:semian] if options.key?(:semian)
|
154
|
-
|
154
|
+
|
155
|
+
options["semian"] if options.key?("semian")
|
155
156
|
end
|
156
157
|
|
157
158
|
def raise_if_out_of_memory(reply)
|
data/lib/semian/redis_client.rb
CHANGED
@@ -33,19 +33,25 @@ class RedisClient
|
|
33
33
|
CircuitOpenError = Class.new(SemianError)
|
34
34
|
|
35
35
|
module SemianConfig
|
36
|
-
attr_reader :raw_semian_options
|
37
|
-
|
38
36
|
def initialize(semian: nil, **kwargs)
|
39
37
|
super(**kwargs)
|
40
38
|
|
41
39
|
@raw_semian_options = semian
|
42
40
|
end
|
43
41
|
|
42
|
+
def raw_semian_options
|
43
|
+
@raw_semian_options.respond_to?(:call) ? @raw_semian_options.call(host, port) : @raw_semian_options
|
44
|
+
end
|
45
|
+
|
44
46
|
def semian_identifier
|
45
|
-
@semian_identifier
|
47
|
+
return @semian_identifier if @semian_identifier
|
48
|
+
|
49
|
+
identifier = begin
|
46
50
|
name = (semian_options && semian_options[:name]) || "#{host}:#{port}/#{db}"
|
47
51
|
:"redis_#{name}"
|
48
52
|
end
|
53
|
+
@semian_identifier = identifier unless semian_options && semian_options[:dynamic]
|
54
|
+
identifier
|
49
55
|
end
|
50
56
|
|
51
57
|
define_method(:semian_options, Semian::Adapter.instance_method(:semian_options))
|
data/lib/semian/version.rb
CHANGED
data/lib/semian.rb
CHANGED
@@ -100,6 +100,7 @@ module Semian
|
|
100
100
|
TimeoutError = Class.new(BaseError)
|
101
101
|
InternalError = Class.new(BaseError)
|
102
102
|
OpenCircuitError = Class.new(BaseError)
|
103
|
+
SemaphoreMissingError = Class.new(BaseError)
|
103
104
|
|
104
105
|
attr_accessor :maximum_lru_size, :minimum_lru_time, :default_permissions, :namespace
|
105
106
|
|
metadata
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: semian
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.22.0.RC.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Scott Francis
|
8
8
|
- Simon Eskildsen
|
9
9
|
- Dale Hamel
|
10
|
-
autorequire:
|
10
|
+
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2024-02
|
13
|
+
date: 2024-07-02 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
|
@@ -64,7 +64,7 @@ metadata:
|
|
64
64
|
documentation_uri: https://github.com/Shopify/semian
|
65
65
|
homepage_uri: https://github.com/Shopify/semian
|
66
66
|
source_code_uri: https://github.com/Shopify/semian
|
67
|
-
post_install_message:
|
67
|
+
post_install_message:
|
68
68
|
rdoc_options: []
|
69
69
|
require_paths:
|
70
70
|
- lib
|
@@ -72,15 +72,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
72
72
|
requirements:
|
73
73
|
- - ">="
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version:
|
75
|
+
version: 2.7.0
|
76
76
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
77
77
|
requirements:
|
78
78
|
- - ">="
|
79
79
|
- !ruby/object:Gem::Version
|
80
80
|
version: '0'
|
81
81
|
requirements: []
|
82
|
-
rubygems_version: 3.5.
|
83
|
-
signing_key:
|
82
|
+
rubygems_version: 3.5.14
|
83
|
+
signing_key:
|
84
84
|
specification_version: 4
|
85
85
|
summary: Bulkheading for Ruby with SysV semaphores
|
86
86
|
test_files: []
|