Make reconnection failure error non-fatal to allow service failover
A single service failing to reconnect should not kill the entire pipeline. Non-fatal errors flow through the pipeline so application code (e.g. ServiceSwitcher) can handle failover to a backup service.
This commit is contained in:
@@ -107,12 +107,12 @@ class WebsocketService(ABC):
|
||||
)
|
||||
wait_time = exponential_backoff_time(attempt)
|
||||
await asyncio.sleep(wait_time)
|
||||
fatal_msg = f"{self} failed to reconnect after {max_retries} attempts"
|
||||
msg = f"{self} failed to reconnect after {max_retries} attempts"
|
||||
if last_exception:
|
||||
fatal_msg += f": {last_exception}"
|
||||
logger.error(fatal_msg)
|
||||
msg += f": {last_exception}"
|
||||
logger.error(msg)
|
||||
if report_error:
|
||||
await report_error(ErrorFrame(fatal_msg, fatal=True))
|
||||
await report_error(ErrorFrame(msg))
|
||||
return False
|
||||
finally:
|
||||
self._reconnect_in_progress = False
|
||||
|
||||
Reference in New Issue
Block a user