[pbs-devel] [PATCH proxmox-backup] fix #5622: backup client: properly handle rate/burst parameters

Christian Ebner c.ebner at proxmox.com
Tue Jul 23 14:51:48 CEST 2024


> On 23.07.2024 14:48 CEST Christian Ebner <c.ebner at proxmox.com> wrote:
> 
>  
> On 7/23/24 12:04, Dominik Csapak wrote:
> > the rate and burst parameters are integers, so the mapping from value
> > with `.as_str()` will always return `None` effectively never
> > applying any rate limit at all.
> > 
> > To fix it, just map from u64 to HumanByte.
> > 
> > Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
> > ---
> > 
> > Alternatively, we could introduce a new string schema to parse into
> > HumanByte, if that's preferred. (Did not do it that way, because this
> > fix was way faster for me and is also OK in my opinion).
> 
> There is already a string schema definition for rate limits [0], might 
> be worth to reuse that and parse into `HumanByte` as you suggested?
> 
> [0] 
> https://git.proxmox.com/?p=proxmox-backup.git;a=blob;f=pbs-api-types/src/traffic_control.rs;h=fb264531e291329fbc0a0a7f54da158ba50e8bb1;hb=HEAD#l21

Ah no, this is the already used IntegerSchema, never mind.




More information about the pbs-devel mailing list