protobuf 3.10.1 → 3.10.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: 8631e0e157cd16a50b428ca4888a48d8b294002e1844beca975db88c696038ed
4
- data.tar.gz: 9111c88f5b491c625155ce1ee683f0462778a3b7ae9e49671333275e9829bca0
3
+ metadata.gz: 3abda94df908b555f894e94c32c31beba81221ba3da45ceb2096f5f0ad45d698
4
+ data.tar.gz: df520f797618b9c3a2273973c982848ef243a731494ca0d9f44ef3e6945bef03
5
5
  SHA512:
6
- metadata.gz: bb3d3ee59579cb21771885ebd0ee7bda1e0aa09736cfc15b3053ca9b6206769b5e4eaa2ea8b8ad4d3fb77a85b0dfc985cd69012bda90c0ee23d8e673aed6e373
7
- data.tar.gz: feb9889203fa3fc6d33c6efeb74fe8a22ccca41af5bb1f3e15f517ce0a1b8fff07b5a1145117f056dbd5a314498ea70851240dd77969fd7b82742b700e5d1bea
6
+ metadata.gz: 62c8630d594b1a2599b4349a2cc84e50e1090a4e04e68f2a3b9774cbb18fd6793e3c4eaf8e5779bc6bddb5b9b8affa68d2ef18903111f7f5db8a8095bf9e0f42
7
+ data.tar.gz: ffae80308a6ed7d65aa5dac437e6bb0d08e292b6ffea3ee7a06c49394425e38a95bf8387eb9735b3d350c70c21db1f9a96438833120b1d1a3d89207de18008d8
@@ -54,6 +54,18 @@ module Protobuf
54
54
  attr_writer :client_host
55
55
  end
56
56
 
57
+ def self.after_server_bind(&block)
58
+ ::ActiveSupport::Notifications.subscribe('after_server_bind') do |*args|
59
+ block.call(*args)
60
+ end
61
+ end
62
+
63
+ def self.before_server_bind(&block)
64
+ ::ActiveSupport::Notifications.subscribe('before_server_bind') do |*args|
65
+ block.call(*args)
66
+ end
67
+ end
68
+
57
69
  def self.client_host
58
70
  @client_host ||= Socket.gethostname
59
71
  end
@@ -240,6 +240,8 @@ module Protobuf
240
240
  def start_server
241
241
  debug_say('Running server')
242
242
 
243
+ ::ActiveSupport::Notifications.instrument("before_server_bind")
244
+
243
245
  runner.run do
244
246
  logger.info do
245
247
  "pid #{::Process.pid} -- #{mode} RPC Server listening at #{options.host}:#{options.port}"
@@ -1,3 +1,3 @@
1
1
  module Protobuf
2
- VERSION = '3.10.1' # rubocop:disable Style/MutableConstant
2
+ VERSION = '3.10.2' # rubocop:disable Style/MutableConstant
3
3
  end
@@ -275,6 +275,41 @@ RSpec.describe ::Protobuf::CLI do
275
275
  end
276
276
  end
277
277
 
278
+ context 'after server bind' do
279
+ let(:sock_runner) { double("FakeRunner", :run => nil) }
280
+
281
+ before { allow(sock_runner).to receive(:run).and_yield }
282
+
283
+ it 'publishes when using the lib/protobuf callback' do
284
+ message_after_bind = false
285
+ ::Protobuf.after_server_bind do
286
+ message_after_bind = true
287
+ end
288
+ described_class.start(args)
289
+ expect(message_after_bind).to eq(true)
290
+ end
291
+ end
292
+
293
+ context 'before server bind' do
294
+ it 'publishes a message before the runner runs' do
295
+ message_before_bind = false
296
+ ::ActiveSupport::Notifications.subscribe('before_server_bind') do
297
+ message_before_bind = true
298
+ end
299
+ described_class.start(args)
300
+ expect(message_before_bind).to eq(true)
301
+ end
302
+
303
+ it 'publishes when using the lib/protobuf callback' do
304
+ message_before_bind = false
305
+ ::Protobuf.before_server_bind do
306
+ message_before_bind = true
307
+ end
308
+ described_class.start(args)
309
+ expect(message_before_bind).to eq(true)
310
+ end
311
+ end
312
+
278
313
  end
279
314
 
280
315
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: protobuf
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.10.1
4
+ version: 3.10.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - BJ Neilsen
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2019-08-28 00:00:00.000000000 Z
14
+ date: 2019-10-14 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: activesupport