lib/anycable/cli.rb in anycable-0.6.5 vs lib/anycable/cli.rb in anycable-1.0.0.preview1
- old
+ new
@@ -34,22 +34,24 @@
parse_gem_options!(extra_options)
configure_server!
- logger.info "Starting AnyCable gRPC server (pid: #{Process.pid})"
+ logger.info "Starting AnyCable gRPC server (pid: #{Process.pid}, workers_num: #{config.rpc_pool_size})"
print_versions!
- logger.info "Serving #{defined?(::Rails) ? 'Rails ' : ''}application from #{boot_file}"
+ logger.info "Serving #{defined?(::Rails) ? "Rails " : ""}application from #{boot_file}"
verify_connection_factory!
log_grpc! if config.log_grpc
log_errors!
+ use_version_check! if config.version_check_enabled?
+
@server = AnyCable::Server.new(
host: config.rpc_host,
**config.to_grpc_params,
interceptors: AnyCable.middleware.to_a
)
@@ -122,11 +124,11 @@
self_read
end
def print_versions!
- logger.info "AnyCable version: #{AnyCable::VERSION}"
+ logger.info "AnyCable version: #{AnyCable::VERSION} (proto_version: #{AnyCable::PROTO_VERSION})"
logger.info "gRPC version: #{GRPC::VERSION}"
end
# rubocop:disable Metrics/MethodLength
def boot_app!
@@ -158,9 +160,17 @@
APP_CANDIDATES.detect { |path| File.exist?(path) }
end
def configure_server!
AnyCable.server_callbacks.each(&:call)
+ end
+
+ def use_version_check!
+ require "anycable/middlewares/check_version"
+
+ AnyCable.middleware.use(
+ AnyCable::Middlewares::CheckVersion.new(AnyCable::PROTO_VERSION)
+ )
end
def start_health_server!
@health_server = AnyCable::HealthServer.new(
server,