diff options
| author | soryu <soryu@soryu.co> | 2026-01-18 18:35:44 +0000 |
|---|---|---|
| committer | soryu <soryu@soryu.co> | 2026-01-18 18:35:44 +0000 |
| commit | 273da072fa0573c935798dc723ed79fd71ab037a (patch) | |
| tree | 02972b8d5e65a90b763995895bdb8f92a175c0d0 /makima/src/server/state.rs | |
| parent | e0da93a20a965125ba4cbb46e3e0e179f06c2a08 (diff) | |
| download | soryu-273da072fa0573c935798dc723ed79fd71ab037a.tar.gz soryu-273da072fa0573c935798dc723ed79fd71ab037a.zip | |
Fix: Find alternate daemon
Diffstat (limited to 'makima/src/server/state.rs')
| -rw-r--r-- | makima/src/server/state.rs | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/makima/src/server/state.rs b/makima/src/server/state.rs index 479eadf..d022834 100644 --- a/makima/src/server/state.rs +++ b/makima/src/server/state.rs @@ -884,6 +884,29 @@ impl AppState { .collect() } + /// Find an alternative daemon for a task, excluding specified daemon IDs. + /// Returns the daemon ID and connection info if found. + pub fn find_alternative_daemon( + &self, + owner_id: Uuid, + exclude_daemon_ids: &[Uuid], + ) -> Option<Uuid> { + self.daemon_connections + .iter() + .find(|entry| { + let daemon = entry.value(); + daemon.owner_id == owner_id && !exclude_daemon_ids.contains(&daemon.id) + }) + .map(|entry| entry.value().id) + } + + /// Check if a specific daemon is connected. + pub fn is_daemon_connected(&self, daemon_id: Uuid) -> bool { + self.daemon_connections + .iter() + .any(|entry| entry.value().id == daemon_id) + } + // ========================================================================= // Tool Key Management // ========================================================================= |
