From 721f662bbefb0b3b54ac02fb12866f2971658526 Mon Sep 17 00:00:00 2001 From: Filipi Fuchter Date: Tue, 1 Jul 2025 17:09:05 -0300 Subject: [PATCH] Making cancel sentinel classes private --- src/pipecat/utils/asyncio/watchdog_priority_queue.py | 6 +++--- src/pipecat/utils/asyncio/watchdog_queue.py | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/pipecat/utils/asyncio/watchdog_priority_queue.py b/src/pipecat/utils/asyncio/watchdog_priority_queue.py index 2bd630fba..98d7f9172 100644 --- a/src/pipecat/utils/asyncio/watchdog_priority_queue.py +++ b/src/pipecat/utils/asyncio/watchdog_priority_queue.py @@ -20,7 +20,7 @@ from pipecat.utils.asyncio.task_manager import BaseTaskManager @dataclass -class WatchdogPriorityCancelSentinel: +class _WatchdogPriorityCancelSentinel: def __lt__(self, other): return True @@ -62,7 +62,7 @@ class WatchdogPriorityQueue(asyncio.PriorityQueue): else: get_result = await super().get() - if isinstance(get_result, WatchdogPriorityCancelSentinel): + if isinstance(get_result, _WatchdogPriorityCancelSentinel): logger.debug( "Received WatchdogPriorityCancelSentinel, throwing CancelledError to force cancelling" ) @@ -91,7 +91,7 @@ class WatchdogPriorityQueue(asyncio.PriorityQueue): forces the task to raise CancelledError when consumed, ensuring proper task termination. """ - super().put_nowait(WatchdogPriorityCancelSentinel()) + super().put_nowait(_WatchdogPriorityCancelSentinel()) async def _watchdog_get(self): """Get item from queue while periodically resetting watchdog timer.""" diff --git a/src/pipecat/utils/asyncio/watchdog_queue.py b/src/pipecat/utils/asyncio/watchdog_queue.py index e3e379f3d..53b04c534 100644 --- a/src/pipecat/utils/asyncio/watchdog_queue.py +++ b/src/pipecat/utils/asyncio/watchdog_queue.py @@ -20,7 +20,7 @@ from pipecat.utils.asyncio.task_manager import BaseTaskManager @dataclass -class WatchdogQueueCancelSentinel: +class _WatchdogQueueCancelSentinel: pass @@ -61,7 +61,7 @@ class WatchdogQueue(asyncio.Queue): else: get_result = await super().get() - if isinstance(get_result, WatchdogQueueCancelSentinel): + if isinstance(get_result, _WatchdogQueueCancelSentinel): logger.debug( "Received WatchdogQueueCancelFrame, throwing CancelledError to force cancelling" ) @@ -90,7 +90,7 @@ class WatchdogQueue(asyncio.Queue): forces the task to raise CancelledError when consumed, ensuring proper task termination. """ - super().put_nowait(WatchdogQueueCancelSentinel()) + super().put_nowait(_WatchdogQueueCancelSentinel()) async def _watchdog_get(self): """Get item from queue while periodically resetting watchdog timer."""