Merge pull request #4149 from pipecat-ai/mb/fix-service-switcher-passthrough-errors
Fix ServiceSwitcher reacting to pass-through ErrorFrames
This commit is contained in:
@@ -193,7 +193,8 @@ class ServiceSwitcherStrategyFailover(ServiceSwitcherStrategyManual):
|
||||
The newly active service if a switch occurred, or None if no
|
||||
other service is available.
|
||||
"""
|
||||
logger.warning(f"Service {self._active_service.name} reported an error: {error.error}")
|
||||
service_name = error.processor.name if error.processor else self._active_service.name
|
||||
logger.warning(f"Service {service_name} reported an error: {error.error}")
|
||||
|
||||
if len(self._services) <= 1:
|
||||
logger.error("No other service available to switch to")
|
||||
@@ -312,9 +313,11 @@ class ServiceSwitcher(ParallelPipeline, Generic[StrategyType]):
|
||||
if frame.service_name != self.strategy.active_service.name:
|
||||
return
|
||||
|
||||
# Let the strategy react to non-fatal errors from the active service.
|
||||
# Let the strategy react to non-fatal errors from the active service,
|
||||
# ignoring errors just propagating upstream from other processors.
|
||||
if isinstance(frame, ErrorFrame) and not frame.fatal:
|
||||
await self.strategy.handle_error(frame)
|
||||
if frame.processor and frame.processor == self.strategy.active_service:
|
||||
await self.strategy.handle_error(frame)
|
||||
|
||||
await super().push_frame(frame, direction)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user