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
diff --git a/google/api_core/bidi.py b/google/api_core/bidi.py
index 74abc49..17d836d 100644
--- a/google/api_core/bidi.py
+++ b/google/api_core/bidi.py
@@ -91,8 +91,12 @@
def _is_active(self):
# Note: there is a possibility that this starts *before* the call
# property is set. So we have to check if self.call is set before
- # seeing if it's active.
- return self.call is not None and self.call.is_active()
+ # seeing if it's active. We need to return True if self.call is None.
+ # See https://github.com/googleapis/python-api-core/issues/560.
+ if self.call is not None and not self.call.is_active():
+ return False
+ else:
+ return True
def __iter__(self):
if self._initial_request is not None: