[pdm-devel] [PATCH datacenter-manager 4/6] ui: resource tree: use an async pool for requests
Shannon Sterz
s.sterz at proxmox.com
Thu Nov 27 16:36:07 CET 2025
the async pool will abort the requests it is managing when the
component is dropped. this avoids a potential race condition between
these requests and a log in attempted right after a log out.
Signed-off-by: Shannon Sterz <s.sterz at proxmox.com>
---
ui/src/widget/resource_tree.rs | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/ui/src/widget/resource_tree.rs b/ui/src/widget/resource_tree.rs
index 9f17634..c7d6e67 100644
--- a/ui/src/widget/resource_tree.rs
+++ b/ui/src/widget/resource_tree.rs
@@ -22,6 +22,7 @@ use pwt::{
},
ActionIcon, Column, Container, Fa, Panel, Progress, Row, Tooltip,
},
+ AsyncPool,
};
use pwt_macros::{builder, widget};
@@ -143,6 +144,7 @@ pub struct PdmResourceTree {
_context_listener: ContextHandle<RemoteList>,
selection: Selection,
_load_timeout: Option<Timeout>,
+ async_pool: AsyncPool,
}
impl PdmResourceTree {}
@@ -173,6 +175,7 @@ impl Component for PdmResourceTree {
_context_listener,
selection,
_load_timeout: None,
+ async_pool: AsyncPool::new(),
}
}
@@ -189,8 +192,9 @@ impl Component for PdmResourceTree {
.and_then(|(context, _)| context.name);
if !props.search_only || !search_term.is_empty() {
+ let async_pool = self.async_pool.clone();
self._load_timeout = Some(Timeout::new(INPUT_BUFFER_MS, move || {
- link.send_future(async move {
+ async_pool.send_future(link, async move {
Msg::LoadResult(load_resources(search_term, view).await)
});
}));
--
2.47.3
More information about the pdm-devel
mailing list