[pdm-devel] [PATCH datacenter-manager] ui: resource tree: use AsyncPool to cancel obsolete pending loads
Dominik Csapak
d.csapak at proxmox.com
Fri Apr 18 08:10:38 CEST 2025
On 4/17/25 17:43, Thomas Lamprecht wrote:
> Am 16.04.25 um 13:32 schrieb Dominik Csapak:
>> Currently, if a new serach term is given, a new load will occur if the
>> INPUT_BUFFER_MS time is reached. Any old in-flight API requests are not
>> canceled, and might still arrive.
>>
>> To prevent that, use an AsyncPool and refresh that when the search term
>> changes.
>
> I forgot a few details here, but would it be possible to provide a wrapper
> component for such things? I.e. fields where editing will trigger an API
> request. As to me, it feels like this is an easy error to make for any
> such fields, especially as it normally won't be noticed if tested locally
> with <1ms network latency and the often relatively smaller (test) setups,
> where the code querying the data in the backend needs only a few ms too.
mhmm, the AsyncPool is already the helper wrapper we should use for this,
we just have to apply it consistently.
The only special thing we do here is to replace the asyncpool with a new
one in the 'changed' method.
maybe a method for the async pool that takes additionally an id and
replaces the old future with the new one in case there is already
an in flight future with the same name?
(we use the asyncpool to handle multiple futures, so we'd need
to identify them)
>
> But in any way not something that needs to delay applying this patch.
>
More information about the pdm-devel
mailing list