gruf 2.16.0 → 2.16.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3d83766bdf6739e3997891fd7b5e5ecd393aa17c8fab0ab839ff0789756726cf
4
- data.tar.gz: b959a1644c29c5732438a60a079dc318136146eddb96d4060091f0f39fc7e5c6
3
+ metadata.gz: f0508561578b2ebd6490bebfeeee8f4442d4bcec1d1cb877dc0005933564fc33
4
+ data.tar.gz: b4130a47d10681a4876046aa782640091799d99f433cc5f6ae55f6dce1f60ecf
5
5
  SHA512:
6
- metadata.gz: ef7b011e2d693c2cb05b10697e0b67fcedb1d72ffc8adeac5f207557a30494860878a5b80e94fc8d512e7a4e5e6cb69b2bc8a854e72cd80f2e1507e0c1f379b6
7
- data.tar.gz: a75845718660f4013015eff266c737315ce7bb00e147c83bc175390c87d890be525ee88059f5bb3ec224bbe30a96fb348143dfccd0c377a2dee8bd3eb674a6ea
6
+ metadata.gz: 1a9e198be4481b4e56c3e57fb7d76be2ce97e6cbe30368fadc990a505d1864c98f1e0d25f02c8209a0dafd89021537b15f6f12a83323ec3c8a7ff114c7c8094b
7
+ data.tar.gz: 5fc8489af23aa0e387aa84dc4104e7812aa0a767ddb32e6bf83f331442b79073f57c5ef97b2326ff9ec64cebf018d76589ce5f964bf67a69e758dd0780508423
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.16.2
6
+
7
+ * [#175] Fix code reload thread-safety. Calls to `Zeitwerk::Loader#setup` are now made in a thread-safe manner.
8
+
9
+ ### 2.16.1
10
+
11
+ * Fix issue where default gRPC health check was loaded even if unused or not desired; now only loaded when requested
12
+
13
+ ### 2.16.0
14
+
5
15
  - Add opt-in ability to serve the official [gRPC health check](https://github.com/grpc/grpc/blob/master/src/ruby/pb/grpc/health/v1/health_services_pb.rb)
6
16
  automatically via `health_check_enabled` configuration option (or `GRUF_HEALTH_CHECK_ENABLED` environment
7
17
  variable).
@@ -161,9 +161,7 @@ module Gruf
161
161
  def bind_health_check!(services)
162
162
  # do this here to trigger autoloading the controller in zeitwerk, since we don't explicitly load this
163
163
  # controller. This binds the service and makes sure the method handlers are setup.
164
- # rubocop:disable Lint/Void
165
- Gruf::Controllers::HealthController
166
- # rubocop:enable Lint/Void
164
+ require 'gruf/controllers/health_controller'
167
165
  # if we're already bound to the services array (say someone explicitly passes the health check in, skip)
168
166
  return services if services.include?(::Grpc::Health::V1::Health::Service)
169
167
 
@@ -47,7 +47,11 @@ module Gruf
47
47
  # Reload all files managed by the autoloader, if reloading is enabled
48
48
  #
49
49
  def reload
50
- @loader.reload if @reloading_enabled
50
+ if @reloading_enabled
51
+ reload_mutex do
52
+ @loader.reload
53
+ end
54
+ end
51
55
  end
52
56
 
53
57
  private
@@ -69,6 +73,17 @@ module Gruf
69
73
  @loader.eager_load
70
74
  @setup = true
71
75
  end
76
+
77
+ ##
78
+ # Handle thread-safe access to the loader
79
+ #
80
+ def reload_mutex(&block)
81
+ @reload_mutex ||= begin
82
+ require 'monitor'
83
+ Monitor.new
84
+ end
85
+ @reload_mutex.synchronize(&block)
86
+ end
72
87
  end
73
88
  end
74
89
  end
@@ -15,6 +15,8 @@
15
15
  # COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
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
+ require 'grpc/health/v1/health_services_pb'
19
+
18
20
  module Gruf
19
21
  module Controllers
20
22
  ##
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.16.0'
19
+ VERSION = '2.16.2'
20
20
  end
data/lib/gruf.rb CHANGED
@@ -20,7 +20,6 @@ require 'active_support/core_ext/module/delegation'
20
20
  require 'active_support/hash_with_indifferent_access'
21
21
  require 'active_support/concern'
22
22
  require 'active_support/inflector'
23
- require 'grpc/health/v1/health_services_pb'
24
23
  require 'base64'
25
24
 
26
25
  # use Zeitwerk to lazily autoload all the files in the lib directory
@@ -29,6 +28,7 @@ loader = ::Zeitwerk::Loader.new
29
28
  loader.tag = File.basename(__FILE__, '.rb')
30
29
  loader.inflector = ::Zeitwerk::GemInflector.new(__FILE__)
31
30
  loader.ignore("#{__dir__}/gruf/integrations/rails/railtie.rb")
31
+ loader.ignore("#{__dir__}/gruf/controllers/health_controller.rb")
32
32
  loader.push_dir(__dir__)
33
33
  loader.setup
34
34
 
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.16.0
4
+ version: 2.16.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shaun McCormick
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-08-14 00:00:00.000000000 Z
11
+ date: 2022-11-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler-audit