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

Handle NoneType exit event #365

Merged
merged 2 commits into from
Apr 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions deepgram/clients/live/v1/async_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ async def _listening(self) -> None:

while True:
try:
if self._exit_event.is_set():
if self._exit_event is not None and self._exit_event.is_set():
self.logger.notice("_listening exiting gracefully")
self.logger.debug("AsyncLiveClient._listening LEAVE")
return
Expand Down Expand Up @@ -336,7 +336,7 @@ async def _keep_alive(self) -> None:
counter += 1
await asyncio.sleep(ONE_SECOND)

if self._exit_event.is_set():
if self._exit_event is not None and self._exit_event.is_set():
self.logger.notice("_keep_alive exiting gracefully")
self.logger.debug("AsyncLiveClient._keep_alive LEAVE")
return
Expand Down Expand Up @@ -409,7 +409,7 @@ async def send(self, data: Union[str, bytes]) -> bool:
"""
self.logger.spam("AsyncLiveClient.send ENTER")

if self._exit_event.is_set():
if self._exit_event is not None and self._exit_event.is_set():
self.logger.notice("send exiting gracefully")
self.logger.debug("AsyncLiveClient.send LEAVE")
return False
Expand Down
6 changes: 3 additions & 3 deletions deepgram/clients/live/v1/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ def _listening(self) -> None:

while True:
try:
if self._exit_event.is_set():
if self._exit_event is not None and self._exit_event.is_set():
self.logger.notice("_listening exiting gracefully")
self.logger.debug("LiveClient._listening LEAVE")
return
Expand Down Expand Up @@ -336,7 +336,7 @@ def _keep_alive(self) -> None:
counter += 1

self._exit_event.wait(timeout=ONE_SECOND)
if self._exit_event.is_set():
if self._exit_event is not None and self._exit_event.is_set():
self.logger.notice("_keep_alive exiting gracefully")
self.logger.debug("LiveClient._keep_alive LEAVE")
return
Expand Down Expand Up @@ -407,7 +407,7 @@ def send(self, data: Union[str, bytes]) -> bool:
"""
self.logger.spam("LiveClient.send ENTER")

if self._exit_event.is_set():
if self._exit_event is not None and self._exit_event.is_set():
self.logger.notice("send exiting gracefully")
self.logger.debug("AsyncLiveClient.send LEAVE")
return False
Expand Down
Loading