fix(connlib): exit phoenix-channel event-loop on error (#10229)

We cannot poll the `PhoenixChannel` after it has returned an error,
otherwise it will panic. Therefore, we exit the event-loop then. The
outer event-loop also exits as soon as it receives an error from this
channel so this is fine.

`PhoenixChannel` only returns an error when it has irrecoverably
disconnected, e.g. after the retries have been exhausted or we hit a 4xx
error on the WebSocket connection.

---------

Signed-off-by: Thomas Eizinger <thomas@eizinger.io>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
Thomas Eizinger
2025-08-21 03:25:46 +00:00
committed by GitHub
parent 4e11112d9b
commit b4cbc4f33b
2 changed files with 6 additions and 8 deletions

View File

@@ -479,10 +479,9 @@ async fn phoenix_channel_event_loop(
"Hiccup in portal connection: {error:#}"
),
Either::Left((Err(e), _)) => {
if event_tx.send(PortalEvent::Error(e)).await.is_err() {
tracing::debug!("Event channel closed: exiting phoenix-channel event-loop");
break;
}
let _ = event_tx.send(PortalEvent::Error(e)).await; // We don't care about the result because we are exiting anyway.
break;
}
Either::Right((Some(PortalCommand::Send(msg)), _)) => {
portal.send(PHOENIX_TOPIC, msg);

View File

@@ -632,10 +632,9 @@ async fn phoenix_channel_event_loop(
"Hiccup in portal connection: {error:#}"
),
Either::Left((Err(e), _)) => {
if event_tx.send(Err(e)).await.is_err() {
tracing::debug!("Event channel closed: exiting phoenix-channel event-loop");
break;
}
let _ = event_tx.send(Err(e)).await; // We don't care about the result because we are exiting anyway.
break;
}
Either::Right((Some(PortalCommand::Send(msg)), _)) => {
portal.send(PHOENIX_TOPIC, msg);