gruf 2.19.0 → 2.20.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 15454c9930260897f5d2b7415a5fffcce9eea3430b4012ee0abea150a13b4ccd
4
- data.tar.gz: 7f7bc1675756c4c6ca2ebf0ed7c154ced739bffc039486cbe7b6d61634677c18
3
+ metadata.gz: 321dd6bdff2f6c704c6129569d694f921e29a894eea19a4fff05f46f8900ef5b
4
+ data.tar.gz: 3a756651b5b4fce7212a0101edc86f9e83e3c95e559dc91587989ac1276bc368
5
5
  SHA512:
6
- metadata.gz: '097f461c4837ffe3a0d971050771a052ebb258566861048329c001e935a05d4a7391fbb4de09b31443c3372ff32bae8773939884719f77d1c5c7b898a1c0fc44'
7
- data.tar.gz: 7aa0ddb128a2aabe1b992735a98e99ec513be58420cd8ccac979f6195d34ce371b6f8af6ef873307daec2d4949b7cddcbddc70e7a38133624a937206c73f71ae
6
+ metadata.gz: 454f4579f37b896b34a89d33902eb9c14ec33e94ea408fcffc918922d23e0f56c0bcc287bac5533322a9fd3897e21a64d51eadc9982c3a781b91f97067157e0e
7
+ data.tar.gz: 3892aa18eecaa9aee049961cee2d3ba6695b3c695cc6f66e7eee03fae17de869043922e147d829e8f8b0d94058b99ce48abab2ed6ce00c0d5bba995ce7388a59
data/CHANGELOG.md CHANGED
@@ -2,6 +2,16 @@ Changelog for the gruf gem. This includes internal history before the gem was ma
2
2
 
3
3
  ### Pending release
4
4
 
5
+ ### 2.20.1
6
+
7
+ * [#208] Fix rails `clear_active_connections!` deprecation warning
8
+
9
+ ### 2.20.0
10
+
11
+ * [#190] Remove unsued `e2mmap` and `thwait` gems from `runtime_dependency`.
12
+ * [#194] Add interceptor to reload Rails app code accross requests
13
+ * [#209] Removes manual `establish_connection` and active connection check for each request from `Gruf::Interceptors::ActiveRecord::ConnectionReset`.
14
+
5
15
  ### 2.19.0
6
16
 
7
17
  * [#197] Add support for Ruby 3.3
data/gruf.gemspec CHANGED
@@ -43,13 +43,11 @@ Gem::Specification.new do |spec|
43
43
  'wiki_uri' => 'https://github.com/bigcommerce/gruf/wiki'
44
44
  }
45
45
 
46
- spec.add_runtime_dependency 'activesupport', '> 4'
47
- spec.add_runtime_dependency 'concurrent-ruby', '> 1'
48
- spec.add_runtime_dependency 'e2mmap', '>= 0.1'
49
- spec.add_runtime_dependency 'grpc', '~> 1.10'
50
- spec.add_runtime_dependency 'grpc-tools', '~> 1.10'
51
- spec.add_runtime_dependency 'json', '>= 2.3'
52
- spec.add_runtime_dependency 'slop', '>= 4.6'
53
- spec.add_runtime_dependency 'thwait', '>= 0.1'
54
- spec.add_runtime_dependency 'zeitwerk', '>= 2'
46
+ spec.add_dependency 'activesupport', '> 4'
47
+ spec.add_dependency 'concurrent-ruby', '> 1'
48
+ spec.add_dependency 'grpc', '~> 1.10'
49
+ spec.add_dependency 'grpc-tools', '~> 1.10'
50
+ spec.add_dependency 'json', '>= 2.3'
51
+ spec.add_dependency 'slop', '>= 4.6'
52
+ spec.add_dependency 'zeitwerk', '>= 2'
55
53
  end
@@ -189,6 +189,9 @@ module Gruf
189
189
  self.use_default_interceptors = ::ENV.fetch('GRUF_USE_DEFAULT_INTERCEPTORS', 1).to_i.positive?
190
190
 
191
191
  if use_default_interceptors
192
+ if defined?(::Rails)
193
+ interceptors.use(::Gruf::Interceptors::Rails::Reloader, reloader: Rails.application.reloader)
194
+ end
192
195
  interceptors.use(::Gruf::Interceptors::ActiveRecord::ConnectionReset)
193
196
  interceptors.use(::Gruf::Interceptors::Instrumentation::OutputMetadataTimer)
194
197
  end
@@ -24,16 +24,12 @@ module Gruf
24
24
  class ConnectionReset < ::Gruf::Interceptors::ServerInterceptor
25
25
  ##
26
26
  # Reset any ActiveRecord connections after a gRPC service is called. Because of the way gRPC manages its
27
- # connection pool, we need to ensure that this is done to properly
27
+ # connection pool, we need to ensure that this is done properly
28
28
  #
29
29
  def call
30
- if enabled?
31
- target_classes.each { |klass| klass.establish_connection unless klass.connection.active? }
32
- end
33
-
34
30
  yield
35
31
  ensure
36
- target_classes.each(&:clear_active_connections!) if enabled?
32
+ target_classes.each { |klass| klass.connection_handler.clear_active_connections! } if enabled?
37
33
  end
38
34
 
39
35
  private
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright (c) 2017-present, BigCommerce Pty. Ltd. All rights reserved
4
+ #
5
+ # Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
6
+ # documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
7
+ # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit
8
+ # persons to whom the Software is furnished to do so, subject to the following conditions:
9
+ #
10
+ # The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
11
+ # Software.
12
+ #
13
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
14
+ # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
15
+ # COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
16
+ # OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
17
+ #
18
+ module Gruf
19
+ module Interceptors
20
+ module Rails
21
+ ##
22
+ # Triggers rails code reloading between requests
23
+ #
24
+ class Reloader < ::Gruf::Interceptors::ServerInterceptor
25
+ def call(&block)
26
+ options[:reloader].wrap(&block)
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
data/lib/gruf/version.rb CHANGED
@@ -16,5 +16,5 @@
16
16
  # OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
17
17
  #
18
18
  module Gruf
19
- VERSION = '2.19.0'
19
+ VERSION = '2.20.1'
20
20
  end
data/lib/gruf.rb CHANGED
@@ -24,12 +24,10 @@ require 'base64'
24
24
 
25
25
  # use Zeitwerk to lazily autoload all the files in the lib directory
26
26
  require 'zeitwerk'
27
- loader = ::Zeitwerk::Loader.new
28
- loader.tag = File.basename(__FILE__, '.rb')
29
- loader.inflector = ::Zeitwerk::GemInflector.new(__FILE__)
30
- loader.ignore("#{__dir__}/gruf/integrations/rails/railtie.rb")
31
- loader.ignore("#{__dir__}/gruf/controllers/health_controller.rb")
32
- loader.push_dir(__dir__)
27
+ loader = Zeitwerk::Loader.for_gem
28
+ lib = File.dirname(__FILE__)
29
+ loader.ignore("#{lib}/gruf/integrations/rails/railtie.rb")
30
+ loader.ignore("#{lib}/gruf/controllers/health_controller.rb")
33
31
  loader.setup
34
32
 
35
33
  require_relative 'gruf/integrations/rails/railtie' if defined?(::Rails)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gruf
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.19.0
4
+ version: 2.20.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shaun McCormick
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-02-05 00:00:00.000000000 Z
11
+ date: 2024-07-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -38,20 +38,6 @@ dependencies:
38
38
  - - ">"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '1'
41
- - !ruby/object:Gem::Dependency
42
- name: e2mmap
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - ">="
46
- - !ruby/object:Gem::Version
47
- version: '0.1'
48
- type: :runtime
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - ">="
53
- - !ruby/object:Gem::Version
54
- version: '0.1'
55
41
  - !ruby/object:Gem::Dependency
56
42
  name: grpc
57
43
  requirement: !ruby/object:Gem::Requirement
@@ -108,20 +94,6 @@ dependencies:
108
94
  - - ">="
109
95
  - !ruby/object:Gem::Version
110
96
  version: '4.6'
111
- - !ruby/object:Gem::Dependency
112
- name: thwait
113
- requirement: !ruby/object:Gem::Requirement
114
- requirements:
115
- - - ">="
116
- - !ruby/object:Gem::Version
117
- version: '0.1'
118
- type: :runtime
119
- prerelease: false
120
- version_requirements: !ruby/object:Gem::Requirement
121
- requirements:
122
- - - ">="
123
- - !ruby/object:Gem::Version
124
- version: '0.1'
125
97
  - !ruby/object:Gem::Dependency
126
98
  name: zeitwerk
127
99
  requirement: !ruby/object:Gem::Requirement
@@ -183,6 +155,7 @@ files:
183
155
  - lib/gruf/interceptors/instrumentation/request_logging/formatters/plain.rb
184
156
  - lib/gruf/interceptors/instrumentation/request_logging/interceptor.rb
185
157
  - lib/gruf/interceptors/instrumentation/statsd.rb
158
+ - lib/gruf/interceptors/rails/reloader.rb
186
159
  - lib/gruf/interceptors/registry.rb
187
160
  - lib/gruf/interceptors/server_interceptor.rb
188
161
  - lib/gruf/interceptors/timer.rb
@@ -224,7 +197,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
224
197
  - !ruby/object:Gem::Version
225
198
  version: '0'
226
199
  requirements: []
227
- rubygems_version: 3.5.3
200
+ rubygems_version: 3.5.9
228
201
  signing_key:
229
202
  specification_version: 4
230
203
  summary: gRPC Ruby Framework