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

feat: add keep alive timeout #182

Merged
merged 2 commits into from Feb 9, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 7 additions & 1 deletion google/cloud/bigtable/client.py
Expand Up @@ -161,7 +161,13 @@ def __init__(
self._emulator_channel = None

if self._emulator_host is not None:
self._emulator_channel = grpc.insecure_channel(self._emulator_host)
self._emulator_channel = grpc.insecure_channel(
kolea2 marked this conversation as resolved.
Show resolved Hide resolved
target=self._emulator_host,
options={
"grpc.keepalive_time_ms": 30000,
"grpc.keepalive_timeout_ms": 10000,
}.items(),
)

if channel is not None:
warnings.warn(
Expand Down
8 changes: 7 additions & 1 deletion tests/unit/test_client.py
Expand Up @@ -170,7 +170,13 @@ def test_constructor_with_emulator_host(self):

self.assertEqual(client._emulator_host, emulator_host)
self.assertIs(client._emulator_channel, factory.return_value)
factory.assert_called_once_with(emulator_host)
factory.assert_called_once_with(
target=emulator_host,
options={
"grpc.keepalive_time_ms": 30000,
"grpc.keepalive_timeout_ms": 10000,
}.items(),
)
getenv.assert_called_once_with(BIGTABLE_EMULATOR)

def test__get_scopes_default(self):
Expand Down