Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support custom settings #22

Merged
merged 2 commits into from
Jul 4, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions lib/grpc_kit/server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class Server
# @param shutdown_timeout [Integer] Number of seconds to wait for the server shutdown
# @param min_pool_size [Integer] A mininum thread pool size
# @param max_pool_size [Integer] A maximum thread pool size
def initialize(interceptors: [], shutdown_timeout: 30, min_pool_size: nil, max_pool_size: nil)
def initialize(interceptors: [], shutdown_timeout: 30, min_pool_size: nil, max_pool_size: nil, settings: [])
@interceptors = interceptors
@shutdown_timeout = shutdown_timeout
@min_pool_size = min_pool_size || GrpcKit::RpcDispatcher::DEFAULT_MIN
Expand All @@ -19,6 +19,7 @@ def initialize(interceptors: [], shutdown_timeout: 30, min_pool_size: nil, max_p
@rpc_descs = {}
@mutex = Mutex.new
@stopping = false
@settings = settings

GrpcKit.logger.debug("Launched grpc_kit(v#{GrpcKit::VERSION})")
end
Expand Down Expand Up @@ -47,7 +48,7 @@ def run(conn)
raise 'Stopping server' if @stopping

establish_session(conn) do |s|
s.submit_settings([])
s.submit_settings(@settings)
s.start
end
end
Expand Down