Avoid cloning events in the app-server thread listener (#55283)

Record whether an event is `ShutdownComplete` before moving it into
`apply_bespoke_event_handling`, preserving shutdown drain notification without
cloning the event.

GitOrigin-RevId: 9e4ca8c657d4d5b98056de8c7aba1391233994c1
This commit is contained in:
Charlie Marsh
2026-10-19 13:27:16 +00:00
committed by copyberry
parent bb8f5304fc
commit b1fd48c48e
@@ -375,8 +375,9 @@ pub(super) async fn ensure_listener_task_running(
&outgoing_for_task, conversation_id,
).await;
}
let is_shutdown_complete = matches!(event.msg, EventMsg::ShutdownComplete);
apply_bespoke_event_handling(
event.clone(),
event,
conversation_id,
conversation.clone(),
thread_manager.clone(),
@@ -385,7 +386,7 @@ pub(super) async fn ensure_listener_task_running(
thread_watch_manager.clone(),
)
.await;
if matches!(event.msg, EventMsg::ShutdownComplete)
if is_shutdown_complete
&& let Some(completion_tx) = thread_state
.lock()
.await