anycable 0.6.0.rc1 → 0.6.0

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: f38ac8ce1378f75f5e1b4379c51254a346a2576fdb8326e6e2efb5d1820e857f
4
- data.tar.gz: 0fa60623686123be319a92c8548b82ae4c3bf9ddadade0234cb3d69118599cd3
3
+ metadata.gz: a9ae04f9598f3eff108b5370c1d173154bdab5d7e025a088a5b72375dc316db6
4
+ data.tar.gz: 932eef1358398dd50d0347f7c16eadae2c3edd1ce431807c115dc3eed7480d5f
5
5
  SHA512:
6
- metadata.gz: 18014f2f1193f3e4f2984e4800b14097e131f9b93e413cada4f29805295c1b8153f75d9e7b00b843feb7e66c34c1ffa3e6c24d5494f3c0e516dc693ed39acb94
7
- data.tar.gz: c27a42de1a8b6539a4906e75afe3cea4ac4a5e39c1a006ed06ba106f0b0f99d51b7052a93e54cbfe8ab72114f7b43f34f692214009038a82f7839e614e960b15
6
+ metadata.gz: 83a118f66c08b3555e5627973160d9f0c09c1796fb6f4f9b7157ed39be8f67cfdf735109d31b8e510b3ef4b6fa94427b9d178e37fb55edc416255763e190e99d
7
+ data.tar.gz: 8df3faa61cbb9f6f36ca1f009842e5f14a1d68e775e2c670b952c61b20c564aad66807bd3c71f61e1895aa17953d365be90e2ca446fa275389c7ec8ad8d0f296
@@ -77,6 +77,10 @@ See [docs](https://docs.anycable.io/#/./middlewares).
77
77
 
78
78
  See [docs](https://docs.anycable.io/#/./health_checking).
79
79
 
80
+ - Added hook to run code only within RPC server context.
81
+
82
+ Use `AnyCable.configure_server { ... }` to run code only when RPC server is running.
83
+
80
84
  ### API changes
81
85
 
82
86
  **NOTE**: the old API is still working but deprecated (you'll see a notice).
@@ -60,6 +60,16 @@ module AnyCable
60
60
  ExceptionsHandling
61
61
  end
62
62
 
63
+ # Register a callback to be invoked before
64
+ # the server starts
65
+ def configure_server(&block)
66
+ server_callbacks << block
67
+ end
68
+
69
+ def server_callbacks
70
+ @server_callbacks ||= []
71
+ end
72
+
63
73
  def broadcast_adapter
64
74
  self.broadcast_adapter = :redis unless instance_variable_defined?(:@broadcast_adapter)
65
75
  @broadcast_adapter
@@ -40,6 +40,8 @@ module AnyCable
40
40
 
41
41
  logger.info "Serving #{defined?(::Rails) ? 'Rails ' : ''}application from #{boot_file}"
42
42
 
43
+ configure_server!
44
+
43
45
  verify_connection_factory!
44
46
 
45
47
  log_grpc! if config.log_grpc
@@ -156,6 +158,10 @@ module AnyCable
156
158
  APP_CANDIDATES.detect { |path| File.exist?(path) }
157
159
  end
158
160
 
161
+ def configure_server!
162
+ AnyCable.server_callbacks.each(&:call)
163
+ end
164
+
159
165
  def start_health_server!
160
166
  @health_server = AnyCable::HealthServer.new(
161
167
  server,
@@ -31,6 +31,8 @@ module AnyCable
31
31
  See https://docs.anycable.io/#upgrade_to_0_6_0
32
32
  DEPRECATION
33
33
 
34
+ AnyCable.server_callbacks.each(&:call)
35
+
34
36
  server = new(
35
37
  host: AnyCable.config.rpc_host,
36
38
  **AnyCable.config.to_grpc_params,
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module AnyCable
4
- VERSION = "0.6.0.rc1"
4
+ VERSION = "0.6.0"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: anycable
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0.rc1
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - palkan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-11-12 00:00:00.000000000 Z
11
+ date: 2018-11-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: anyway_config
@@ -244,9 +244,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
244
244
  version: 2.4.0
245
245
  required_rubygems_version: !ruby/object:Gem::Requirement
246
246
  requirements:
247
- - - ">"
247
+ - - ">="
248
248
  - !ruby/object:Gem::Version
249
- version: 1.3.1
249
+ version: '0'
250
250
  requirements: []
251
251
  rubyforge_project:
252
252
  rubygems_version: 2.7.7