gruf 2.19.0 → 2.20.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/gruf.gemspec +0 -2
- data/lib/gruf/configuration.rb +3 -0
- data/lib/gruf/interceptors/active_record/connection_reset.rb +0 -4
- data/lib/gruf/interceptors/rails/reloader.rb +31 -0
- data/lib/gruf/version.rb +1 -1
- data/lib/gruf.rb +4 -6
- metadata +3 -30
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2166dad751c35484b12695d4d7a733c7c629a9ed0ee6088d6135f261d248c787
|
4
|
+
data.tar.gz: 1787a34eefd69424a5c1902f0d8c097657e1dba36be761a238abc803bf3d4c02
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8b3da76c05e413641d0be365bf717fddbe86767975eb9f69ffc7bfd3011af87569bb419ca0ccaa12bf4e49b6a80bc31baa3759e214f44617b87d94d2ef4f8cf2
|
7
|
+
data.tar.gz: d0457693dfb0d7bfe73675e3b0d3cdfc985a2d314c8a5027eb63cc44b254c5e9f4f196fa6101524cb6bb1f1f1f9bfa231b46b2f7b996737cb226bdb025ad4b30
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,12 @@ 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.0
|
6
|
+
|
7
|
+
* [#190] Remove unsued `e2mmap` and `thwait` gems from `runtime_dependency`.
|
8
|
+
* [#194] Add interceptor to reload Rails app code accross requests
|
9
|
+
* [#209] Removes manual `establish_connection` and active connection check for each request from `Gruf::Interceptors::ActiveRecord::ConnectionReset`.
|
10
|
+
|
5
11
|
### 2.19.0
|
6
12
|
|
7
13
|
* [#197] Add support for Ruby 3.3
|
data/gruf.gemspec
CHANGED
@@ -45,11 +45,9 @@ Gem::Specification.new do |spec|
|
|
45
45
|
|
46
46
|
spec.add_runtime_dependency 'activesupport', '> 4'
|
47
47
|
spec.add_runtime_dependency 'concurrent-ruby', '> 1'
|
48
|
-
spec.add_runtime_dependency 'e2mmap', '>= 0.1'
|
49
48
|
spec.add_runtime_dependency 'grpc', '~> 1.10'
|
50
49
|
spec.add_runtime_dependency 'grpc-tools', '~> 1.10'
|
51
50
|
spec.add_runtime_dependency 'json', '>= 2.3'
|
52
51
|
spec.add_runtime_dependency 'slop', '>= 4.6'
|
53
|
-
spec.add_runtime_dependency 'thwait', '>= 0.1'
|
54
52
|
spec.add_runtime_dependency 'zeitwerk', '>= 2'
|
55
53
|
end
|
data/lib/gruf/configuration.rb
CHANGED
@@ -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
|
@@ -27,10 +27,6 @@ module Gruf
|
|
27
27
|
# connection pool, we need to ensure that this is done to 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
32
|
target_classes.each(&:clear_active_connections!) if enabled?
|
@@ -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
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 =
|
28
|
-
|
29
|
-
loader.
|
30
|
-
loader.ignore("#{
|
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.
|
4
|
+
version: 2.20.0
|
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-
|
11
|
+
date: 2024-04-24 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
|