Narrow ServiceSwitcher error check to active service only
Only trigger handle_error for ErrorFrames originating from the active service, not any managed service. This prevents edge cases where errors from a non-active service could incorrectly trigger failover.
This commit is contained in:
@@ -313,12 +313,10 @@ class ServiceSwitcher(ParallelPipeline, Generic[StrategyType]):
|
|||||||
if frame.service_name != self.strategy.active_service.name:
|
if frame.service_name != self.strategy.active_service.name:
|
||||||
return
|
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,
|
||||||
# We check that the error originated from one of our managed services
|
# ignoring errors just propagating upstream from other processors.
|
||||||
# to avoid reacting to errors that are just propagating upstream
|
|
||||||
# through the pipeline from downstream processors.
|
|
||||||
if isinstance(frame, ErrorFrame) and not frame.fatal:
|
if isinstance(frame, ErrorFrame) and not frame.fatal:
|
||||||
if frame.processor and frame.processor in self._services:
|
if frame.processor and frame.processor == self.strategy.active_service:
|
||||||
await self.strategy.handle_error(frame)
|
await self.strategy.handle_error(frame)
|
||||||
|
|
||||||
await super().push_frame(frame, direction)
|
await super().push_frame(frame, direction)
|
||||||
|
|||||||
Reference in New Issue
Block a user