fix: hanging TUI on queueing downloads

This commit is contained in:
Michel de Graaf
2025-11-19 09:13:03 +01:00
parent 9f174c4c5e
commit f5b65053e2
2 changed files with 77 additions and 50 deletions
+10
View File
@@ -370,6 +370,16 @@ impl Client {
.unwrap_or_default()
}
/// Non-blocking variant that returns None if the lock is unavailable
pub fn try_get_search_results(
&self,
search_key: &str,
) -> Option<Vec<SearchResult>> {
self.context.try_read().ok().and_then(|ctx| {
ctx.searches.get(search_key).map(|s| s.results.clone())
})
}
pub fn get_all_searches(&self) -> HashMap<String, Search> {
self.context.read().unwrap().searches.clone()
}