Making cancel sentinel classes private
This commit is contained in:
@@ -20,7 +20,7 @@ from pipecat.utils.asyncio.task_manager import BaseTaskManager
|
|||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
class WatchdogPriorityCancelSentinel:
|
class _WatchdogPriorityCancelSentinel:
|
||||||
def __lt__(self, other):
|
def __lt__(self, other):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
@@ -62,7 +62,7 @@ class WatchdogPriorityQueue(asyncio.PriorityQueue):
|
|||||||
else:
|
else:
|
||||||
get_result = await super().get()
|
get_result = await super().get()
|
||||||
|
|
||||||
if isinstance(get_result, WatchdogPriorityCancelSentinel):
|
if isinstance(get_result, _WatchdogPriorityCancelSentinel):
|
||||||
logger.debug(
|
logger.debug(
|
||||||
"Received WatchdogPriorityCancelSentinel, throwing CancelledError to force cancelling"
|
"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
|
forces the task to raise CancelledError when consumed, ensuring proper
|
||||||
task termination.
|
task termination.
|
||||||
"""
|
"""
|
||||||
super().put_nowait(WatchdogPriorityCancelSentinel())
|
super().put_nowait(_WatchdogPriorityCancelSentinel())
|
||||||
|
|
||||||
async def _watchdog_get(self):
|
async def _watchdog_get(self):
|
||||||
"""Get item from queue while periodically resetting watchdog timer."""
|
"""Get item from queue while periodically resetting watchdog timer."""
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ from pipecat.utils.asyncio.task_manager import BaseTaskManager
|
|||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
class WatchdogQueueCancelSentinel:
|
class _WatchdogQueueCancelSentinel:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
@@ -61,7 +61,7 @@ class WatchdogQueue(asyncio.Queue):
|
|||||||
else:
|
else:
|
||||||
get_result = await super().get()
|
get_result = await super().get()
|
||||||
|
|
||||||
if isinstance(get_result, WatchdogQueueCancelSentinel):
|
if isinstance(get_result, _WatchdogQueueCancelSentinel):
|
||||||
logger.debug(
|
logger.debug(
|
||||||
"Received WatchdogQueueCancelFrame, throwing CancelledError to force cancelling"
|
"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
|
forces the task to raise CancelledError when consumed, ensuring proper
|
||||||
task termination.
|
task termination.
|
||||||
"""
|
"""
|
||||||
super().put_nowait(WatchdogQueueCancelSentinel())
|
super().put_nowait(_WatchdogQueueCancelSentinel())
|
||||||
|
|
||||||
async def _watchdog_get(self):
|
async def _watchdog_get(self):
|
||||||
"""Get item from queue while periodically resetting watchdog timer."""
|
"""Get item from queue while periodically resetting watchdog timer."""
|
||||||
|
|||||||
Reference in New Issue
Block a user