Skip to content

Commit f9a53fe

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 e120a0cdb589d390848b0711ff21c9ff4aab26a9. * add comment
1 parent 569b810 commit f9a53fe

File tree

1 file changed

+6
-2
lines changed
  • packages/google-api-core/google/api_core

1 file changed

+6
-2
lines changed

packages/google-api-core/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)