mirror of
https://github.com/whit3rabbit/anyllm-proxy.git
synced 2026-09-22 00:00:50 +00:00
fix: log warning when managed_backends lock is poisoned during routing
When the managed_backends RwLock is poisoned (indicating a panic in a thread that held the lock), log a warning and skip the managed backend lookup, falling back to the single backend. This improves observability of lock poisoning events. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
b125920a26
commit
af80237cf3
@@ -174,16 +174,19 @@ impl AppState {
|
||||
.or_else(|| {
|
||||
// Check managed backends (SQLite-backed, zero-restart)
|
||||
self.shared.as_ref().and_then(|s| {
|
||||
s.managed_backends
|
||||
let guard = s.managed_backends
|
||||
.read()
|
||||
.ok()?
|
||||
.get(&backend_name)
|
||||
.map(|(_, client)| {
|
||||
let mut state = self.clone();
|
||||
state.backend = client.clone();
|
||||
state.backend_name = backend_name.clone();
|
||||
state
|
||||
})
|
||||
.ok()
|
||||
.or_else(|| {
|
||||
tracing::warn!("managed_backends RwLock is poisoned; skipping managed backend lookup");
|
||||
None
|
||||
})?;
|
||||
guard.get(&backend_name).map(|(_, client)| {
|
||||
let mut state = self.clone();
|
||||
state.backend = client.clone();
|
||||
state.backend_name = backend_name.clone();
|
||||
state
|
||||
})
|
||||
})
|
||||
})
|
||||
.unwrap_or_else(|| self.clone());
|
||||
|
||||
Reference in New Issue
Block a user