semian 0.10.1 → 0.10.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: 36febd25cb5eb31a718290a1a0a7e459357b38465d4ec85711f90ea479341eb8
4
- data.tar.gz: b77a33d7e59940c87f44d85fe6e5deb15a74befc5ca678a643fcea85fa0fdcdb
3
+ metadata.gz: b54ee93c46832142977d1befbd48c6e76e20992573eee798056810cfca6cc2a4
4
+ data.tar.gz: a9a3f804b0aebf6a794c085fc11fb2ea612e876e13d8d6ace6cf3fe4c095e631
5
5
  SHA512:
6
- metadata.gz: 0ad770b1ee2e73b60fec5a14928a0d580f84c6a824b98cf3ccaa298aa5048c60da4ec86d76c11a302a0188e66e1cbfacc98845ff10b49caaa1512ff0878a4db1
7
- data.tar.gz: a176783ad0297ced3e36df28e93a005d55f9127bfca2e1fd11f281a853b098bb6eb9836ae63e7bb4ed998b1285ff7138d2993f432a2300a6cbb675c180d73847
6
+ metadata.gz: f388523a165f4325bb517d801b804a81636008afb6f0c0951be8a4b108323b7621ebf3444925befc2cfd0ac16fdbfc442cb9ec826e19e17ef9aab50769121294
7
+ data.tar.gz: 043bbc5dad551ca00ded71a4026121afbb01f22cda73d526470fe63c1077f590db1ed64449c23f2e2d6b5f735d87e89c266a638f8deff191b944eb98d1f5f361
@@ -1,5 +1,7 @@
1
1
  #include "semian.h"
2
2
 
3
+ VALUE eSyscall, eTimeout, eInternal;
4
+
3
5
  void Init_semian()
4
6
  {
5
7
  VALUE cSemian, cResource;
@@ -22,12 +24,14 @@ void Init_semian()
22
24
  * Represents a Semian error that was caused by an underlying syscall failure.
23
25
  */
24
26
  eSyscall = rb_const_get(cSemian, rb_intern("SyscallError"));
27
+ rb_global_variable(&eSyscall);
25
28
 
26
29
  /* Document-class: Semian::TimeoutError
27
30
  *
28
31
  * Raised when a Semian operation timed out.
29
32
  */
30
33
  eTimeout = rb_const_get(cSemian, rb_intern("TimeoutError"));
34
+ rb_global_variable(&eTimeout);
31
35
 
32
36
  /* Document-class: Semian::InternalError
33
37
  *
@@ -40,6 +44,7 @@ void Init_semian()
40
44
  * the semaphore in this case.
41
45
  */
42
46
  eInternal = rb_const_get(cSemian, rb_intern("InternalError"));
47
+ rb_global_variable(&eInternal);
43
48
 
44
49
  rb_define_alloc_func(cResource, semian_resource_alloc);
45
50
  rb_define_method(cResource, "initialize_semaphore", semian_resource_initialize, 5);
@@ -63,7 +63,7 @@ enum SEMINDEX_ENUM {
63
63
  FOREACH_SEMINDEX(GENERATE_ENUM)
64
64
  };
65
65
 
66
- VALUE eSyscall, eTimeout, eInternal;
66
+ extern VALUE eSyscall, eTimeout, eInternal;
67
67
 
68
68
  // Helper for syscall verbose debugging
69
69
  void
@@ -287,7 +287,7 @@ module Semian
287
287
  Resource.new(name, tickets: options[:tickets], quota: options[:quota], permissions: permissions, timeout: timeout)
288
288
  end
289
289
 
290
- def require_keys!(required = [], **options)
290
+ def require_keys!(required, options)
291
291
  diff = required - options.keys
292
292
  unless diff.empty?
293
293
  raise ArgumentError, "Missing required arguments for Semian: #{diff}"
@@ -79,22 +79,22 @@ module Semian
79
79
  raw_semian_options.nil?
80
80
  end
81
81
 
82
- def request_response(*)
82
+ def request_response(*, **)
83
83
  return super if disabled?
84
84
  acquire_semian_resource(adapter: :grpc, scope: :request_response) { super }
85
85
  end
86
86
 
87
- def client_streamer(*)
87
+ def client_streamer(*, **)
88
88
  return super if disabled?
89
89
  acquire_semian_resource(adapter: :grpc, scope: :client_streamer) { super }
90
90
  end
91
91
 
92
- def server_streamer(*)
92
+ def server_streamer(*, **)
93
93
  return super if disabled?
94
94
  acquire_semian_resource(adapter: :grpc, scope: :server_streamer) { super }
95
95
  end
96
96
 
97
- def bidi_streamer(*)
97
+ def bidi_streamer(*, **)
98
98
  return super if disabled?
99
99
  acquire_semian_resource(adapter: :grpc, scope: :bidi_streamer) { super }
100
100
  end
@@ -37,9 +37,9 @@ module Semian
37
37
  DEFAULT_PORT = 3306
38
38
 
39
39
  QUERY_WHITELIST = Regexp.union(
40
- /\A\s*ROLLBACK/i,
41
- /\A\s*COMMIT/i,
42
- /\A\s*RELEASE\s+SAVEPOINT/i,
40
+ /\A(?:\/\*.*?\*\/)?\s*ROLLBACK/i,
41
+ /\A(?:\/\*.*?\*\/)?\s*COMMIT/i,
42
+ /\A(?:\/\*.*?\*\/)?\s*RELEASE\s+SAVEPOINT/i,
43
43
  )
44
44
 
45
45
  # The naked methods are exposed as `raw_query` and `raw_connect` for instrumentation purpose
@@ -116,7 +116,7 @@ module Semian
116
116
  acquire_semian_resource(adapter: :mysql, scope: :connection) { raw_connect(*args) }
117
117
  end
118
118
 
119
- def acquire_semian_resource(*)
119
+ def acquire_semian_resource(**)
120
120
  super
121
121
  rescue ::Mysql2::Error => error
122
122
  if error.is_a?(PingFailure) || (!error.is_a?(::Mysql2::SemianError) && error.message.match?(CONNECTION_ERROR))
@@ -4,8 +4,8 @@ module Semian
4
4
 
5
5
  class << Semian::Resource
6
6
  # Ensure that there can only be one resource of a given type
7
- def instance(*args)
8
- Semian.resources[args.first] ||= ProtectedResource.new(args.first, new(*args), nil)
7
+ def instance(name, **kwargs)
8
+ Semian.resources[name] ||= ProtectedResource.new(name, new(name, **kwargs), nil)
9
9
  end
10
10
  end
11
11
 
@@ -44,7 +44,7 @@ module Semian
44
44
 
45
45
  module ThreadSafe
46
46
  class SlidingWindow < Simple::SlidingWindow
47
- def initialize(*)
47
+ def initialize(**)
48
48
  super
49
49
  @lock = Mutex.new
50
50
  end
@@ -1,3 +1,3 @@
1
1
  module Semian
2
- VERSION = '0.10.1'
2
+ VERSION = '0.10.6'
3
3
  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.10.1
4
+ version: 0.10.6
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: 2020-03-31 00:00:00.000000000 Z
13
+ date: 2020-11-05 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rake-compiler