mirror of
https://github.com/aljazceru/goose.git
synced 2026-02-10 17:14:28 +01:00
fix: update SSEActor error logging (#2052)
Co-authored-by: Jo Kelly-Fenton <jkellyfenton@spotify.com>
This commit is contained in:
@@ -118,6 +118,14 @@ impl PendingRequests {
|
||||
pub async fn clear(&self) {
|
||||
self.requests.write().await.clear();
|
||||
}
|
||||
|
||||
pub async fn len(&self) -> usize {
|
||||
self.requests.read().await.len()
|
||||
}
|
||||
|
||||
pub async fn is_empty(&self) -> bool {
|
||||
self.len().await == 0
|
||||
}
|
||||
}
|
||||
|
||||
pub mod stdio;
|
||||
|
||||
@@ -210,8 +210,13 @@ impl SseActor {
|
||||
}
|
||||
|
||||
// mpsc channel closed => no more outgoing messages
|
||||
tracing::error!("SseActor: outgoing message loop ended. Clearing pending requests.");
|
||||
pending_requests.clear().await;
|
||||
let pending = pending_requests.len().await;
|
||||
if pending > 0 {
|
||||
tracing::error!("SSE stream ended or encountered an error with {pending} unfulfilled pending requests.");
|
||||
pending_requests.clear().await;
|
||||
} else {
|
||||
tracing::info!("SseActor shutdown cleanly. No pending requests.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user