public inbox for pdm-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Shannon Sterz <s.sterz@proxmox.com>
To: pdm-devel@lists.proxmox.com
Subject: [pdm-devel] [PATCH datacenter-manager 4/6] ui: resource tree: use an async pool for requests
Date: Thu, 27 Nov 2025 16:36:07 +0100	[thread overview]
Message-ID: <20251127153609.440415-6-s.sterz@proxmox.com> (raw)
In-Reply-To: <20251127153609.440415-1-s.sterz@proxmox.com>

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@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



_______________________________________________
pdm-devel mailing list
pdm-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel


  parent reply	other threads:[~2025-11-27 15:36 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-27 15:36 [pdm-devel] [PATCH datacenter-manager/yew-widget-toolkit 0/7] avoid more race conditions on log in Shannon Sterz
2025-11-27 15:36 ` [pdm-devel] [PATCH yew-widget-toolkit 1/1] loader: add helper to allow aborting a load Shannon Sterz
2025-11-27 18:22   ` [pdm-devel] applied: " Thomas Lamprecht
2025-11-27 15:36 ` [pdm-devel] [PATCH datacenter-manager 1/6] ui: main: abort running task load on log out Shannon Sterz
2025-11-27 15:36 ` [pdm-devel] [PATCH datacenter-manager 2/6] ui: main: move requests into an async pool and drop it on logout Shannon Sterz
2025-11-27 15:36 ` [pdm-devel] [PATCH datacenter-manager 3/6] ui: main: only render acl context when we are logged in Shannon Sterz
2025-11-27 15:36 ` Shannon Sterz [this message]
2025-11-27 15:36 ` [pdm-devel] [PATCH datacenter-manager 5/6] ui: node status: handle the request via an AsyncAbortGuard Shannon Sterz
2025-11-27 15:36 ` [pdm-devel] [PATCH datacenter-manager 6/6] ui: top nav bar: use an abort guard for loading the version Shannon Sterz
2025-11-27 20:54 ` [pdm-devel] applied: [PATCH datacenter-manager/yew-widget-toolkit 0/7] avoid more race conditions on log in Thomas Lamprecht

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20251127153609.440415-6-s.sterz@proxmox.com \
    --to=s.sterz@proxmox.com \
    --cc=pdm-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal