Skip to content
This repository was archived by the owner on Apr 1, 2026. It is now read-only.

Commit 150ae3b

Browse files
committed
add wait behind a conditional
1 parent e4d60a8 commit 150ae3b

2 files changed

Lines changed: 8 additions & 6 deletions

File tree

google/cloud/bigtable/data/_async/client.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -480,9 +480,10 @@ async def _manage_channel(
480480
old_channel = super_channel.swap_channel(new_channel)
481481
self._invalidate_channel_stubs()
482482
# give old_channel a chance to complete existing rpcs
483-
await CrossSync.event_wait(
484-
self._is_closed, grace_period, async_break_early=False
485-
)
483+
if grace_period:
484+
await CrossSync.event_wait(
485+
self._is_closed, grace_period, async_break_early=False
486+
)
486487
await old_channel.close()
487488
# subtract the time spent waiting for the channel to be replaced
488489
next_refresh = random.uniform(refresh_interval_min, refresh_interval_max)

google/cloud/bigtable/data/_sync_autogen/client.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -363,9 +363,10 @@ def _manage_channel(
363363
self._ping_and_warm_instances(channel=new_channel)
364364
old_channel = super_channel.swap_channel(new_channel)
365365
self._invalidate_channel_stubs()
366-
CrossSync._Sync_Impl.event_wait(
367-
self._is_closed, grace_period, async_break_early=False
368-
)
366+
if grace_period:
367+
CrossSync._Sync_Impl.event_wait(
368+
self._is_closed, grace_period, async_break_early=False
369+
)
369370
old_channel.close()
370371
next_refresh = random.uniform(refresh_interval_min, refresh_interval_max)
371372
next_sleep = max(next_refresh - (time.monotonic() - start_timestamp), 0)

0 commit comments

Comments
 (0)