Skip to content
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
22 changes: 13 additions & 9 deletions ydb/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
YDB_REQUEST_TYPE_HEADER = "x-ydb-request-type"

_DEFAULT_MAX_GRPC_MESSAGE_SIZE = 64 * 10**6
_DEFAULT_KEEPALIVE_TIMEOUT = 10000


def _message_to_string(message):
Expand Down Expand Up @@ -185,15 +186,18 @@ def _construct_channel_options(driver_config, endpoint_options=None):
getattr(driver_config, "grpc_lb_policy_name", "round_robin"),
),
]
if driver_config.grpc_keep_alive_timeout is not None:
_default_connect_options.extend(
[
("grpc.keepalive_time_ms", driver_config.grpc_keep_alive_timeout >> 3),
("grpc.keepalive_timeout_ms", driver_config.grpc_keep_alive_timeout),
("grpc.http2.max_pings_without_data", 0),
("grpc.keepalive_permit_without_calls", 0),
]
)
if driver_config.grpc_keep_alive_timeout is None:
driver_config.grpc_keep_alive_timeout = _DEFAULT_KEEPALIVE_TIMEOUT

_default_connect_options.extend(
[
("grpc.keepalive_time_ms", driver_config.grpc_keep_alive_timeout >> 3),
("grpc.keepalive_timeout_ms", driver_config.grpc_keep_alive_timeout),
("grpc.http2.max_pings_without_data", 0),
("grpc.keepalive_permit_without_calls", 0),
]
)

if endpoint_options is not None:
if endpoint_options.ssl_target_name_override:
_default_connect_options.append(
Expand Down
Loading