Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 40c8ae0

Browse files
authored
fix: fix regression in bidi causing Thread-ConsumeBidirectionalStream caught unexpected exception and will exit (#562)
* chore: partial revert of PR #357 This reverts commit e120a0c. * add comment
1 parent 3069ef4 commit 40c8ae0

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

google/api_core/bidi.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,12 @@ def __init__(self, queue, period=1, initial_request=None):
9191
def _is_active(self):
9292
# Note: there is a possibility that this starts *before* the call
9393
# property is set. So we have to check if self.call is set before
94-
# seeing if it's active.
95-
return self.call is not None and self.call.is_active()
94+
# seeing if it's active. We need to return True if self.call is None.
95+
# See https://github.com/googleapis/python-api-core/issues/560.
96+
if self.call is not None and not self.call.is_active():
97+
return False
98+
else:
99+
return True
96100

97101
def __iter__(self):
98102
if self._initial_request is not None:

0 commit comments

Comments
 (0)