From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <pbs-devel-bounces@lists.proxmox.com>
Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9])
	by lore.proxmox.com (Postfix) with ESMTPS id BA29C1FF15D
	for <inbox@lore.proxmox.com>; Thu,  8 Aug 2024 08:52:13 +0200 (CEST)
Received: from firstgate.proxmox.com (localhost [127.0.0.1])
	by firstgate.proxmox.com (Proxmox) with ESMTP id 4260418195;
	Thu,  8 Aug 2024 08:52:23 +0200 (CEST)
Message-ID: <455e08d5-1e28-4f64-b84c-cd216fda11af@proxmox.com>
Date: Thu, 8 Aug 2024 08:51:49 +0200
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird Beta
To: Thomas Lamprecht <t.lamprecht@proxmox.com>,
 Proxmox Backup Server development discussion <pbs-devel@lists.proxmox.com>
References: <20240723100448.1571064-1-d.csapak@proxmox.com>
 <db743166-ea39-4287-9b96-90989e6c9fe2@proxmox.com>
Content-Language: en-US
From: Dominik Csapak <d.csapak@proxmox.com>
In-Reply-To: <db743166-ea39-4287-9b96-90989e6c9fe2@proxmox.com>
X-SPAM-LEVEL: Spam detection results:  0
 AWL 0.016 Adjusted score from AWL reputation of From: address
 BAYES_00                 -1.9 Bayes spam probability is 0 to 1%
 DMARC_MISSING             0.1 Missing DMARC policy
 KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment
 RCVD_IN_VALIDITY_CERTIFIED_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to
 Validity was blocked. See
 https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more
 information.
 RCVD_IN_VALIDITY_RPBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to
 Validity was blocked. See
 https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more
 information.
 RCVD_IN_VALIDITY_SAFE_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to
 Validity was blocked. See
 https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more
 information.
 SPF_HELO_NONE           0.001 SPF: HELO does not publish an SPF Record
 SPF_PASS               -0.001 SPF: sender matches SPF record
Subject: Re: [pbs-devel] [PATCH proxmox-backup] fix #5622: backup client:
 properly handle rate/burst parameters
X-BeenThere: pbs-devel@lists.proxmox.com
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Proxmox Backup Server development discussion
 <pbs-devel.lists.proxmox.com>
List-Unsubscribe: <https://lists.proxmox.com/cgi-bin/mailman/options/pbs-devel>, 
 <mailto:pbs-devel-request@lists.proxmox.com?subject=unsubscribe>
List-Archive: <http://lists.proxmox.com/pipermail/pbs-devel/>
List-Post: <mailto:pbs-devel@lists.proxmox.com>
List-Help: <mailto:pbs-devel-request@lists.proxmox.com?subject=help>
List-Subscribe: <https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel>, 
 <mailto:pbs-devel-request@lists.proxmox.com?subject=subscribe>
Reply-To: Proxmox Backup Server development discussion
 <pbs-devel@lists.proxmox.com>
Content-Transfer-Encoding: 7bit
Content-Type: text/plain; charset="us-ascii"; Format="flowed"
Errors-To: pbs-devel-bounces@lists.proxmox.com
Sender: "pbs-devel" <pbs-devel-bounces@lists.proxmox.com>

On 8/7/24 21:20, Thomas Lamprecht wrote:
> On 23/07/2024 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@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).
> 
> I mean, tbh. it seems like this was the original intention, i.e. that one can
> also pass HumanByte here, which would be pretty convenient.
> 
> FWIW, this was u64 back when added and there's a commit that changes this in a
> (buggy) way to the as_str, when HumanByte got introduced:
> 
> 2d5287fb ("use RateLimitConfig for HttpClient and pull")
> 
> Sadly the comment message of this and the previous ones are basically
> non-existent, but I faintly remember that Dietmar and I talked about this back
> then, and I'm pretty sure that my stance back then is as now: I find it odd
> that the API and config can have this written in HumanByte form but not on the
> CLI, where it'd be actually the most useful place; as the API is either
> accessed through web UI, where one can transform this from a human readable
> form to bytes or through a automation system, which normally have ways to
> allow X*1024 or the like calculations.
> 
> So I'd rather go towards a HuamnByte based schema, albeit as the
> TRAFFIC_CONTROL_RATE_SCHEMA and TRAFFIC_CONTROL_BURST_SCHEMA are only used
> in the client CLI code anyway I'd actually drop them from pbs-api-types as
> they are obviously confusing (not used in the actual API) and either declare a
> ClientRateLimitConfig struct there (that is then flattened in the client backup
> schema definition) or just have something directly in the client code.
> 

Sure, make sense, I'll see that I take the time to do that, thanks for the input!


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