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 777611FF16E
	for <inbox@lore.proxmox.com>; Mon, 17 Mar 2025 11:08:11 +0100 (CET)
Received: from firstgate.proxmox.com (localhost [127.0.0.1])
	by firstgate.proxmox.com (Proxmox) with ESMTP id D272636A13;
	Mon, 17 Mar 2025 11:08:00 +0100 (CET)
Message-ID: <66676a8d-15fd-4a2c-b80b-19564cc268df@proxmox.com>
Date: Mon, 17 Mar 2025 11:07:56 +0100
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird Beta
To: pbs-devel@lists.proxmox.com
References: <20250310170125.528732-1-c.ebner@proxmox.com>
Content-Language: en-US
From: Dominik Csapak <d.csapak@proxmox.com>
In-Reply-To: <20250310170125.528732-1-c.ebner@proxmox.com>
X-SPAM-LEVEL: Spam detection results:  0
 AWL 0.021 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
 URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See
 http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more
 information. [proxmox.com, values.id]
Subject: Re: [pbs-devel] [PATCH proxmox-backup 1/2] fix: ui: sync job:
 switch rate limit based on sync direction
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>

High level comment:

I know it's preexisting, bu does it even make sense to have a 'rate-in' and 'rate-out' for sync
jobs? would it not make more sense to have a single 'rate' parameter and apply it to both
directions?

we could maybe introduce a new parameter now to replace both 'rate-in' and 'rate-out' and
use that? we could even maybe leave all three if some users really prefer to set the
limits seperately.

one comment inline

On 3/10/25 18:01, Christian Ebner wrote:
> Commit 9aa213b8 ("config: sync: use same config section type `sync`
> for push and pull") adapted the sync job edit so jobs in both, push
> and pull can be edited using the same window. This however did not
> include the switching of the direction to which the http client rate
> limit is applied to.
> 
> Fix this by renaming the field to `rate-limit` and  conditionally
> settings the values to `rate-in` or `rate-out`.
> 
> Reported in the community forum:
> https://forum.proxmox.com/threads/163414/
> 
> Fixes: 9aa213b8 ("config: sync: use same config section type `sync` for push and pull")
> Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
> ---
>   www/window/SyncJobEdit.js | 20 +++++++++++++++++---
>   1 file changed, 17 insertions(+), 3 deletions(-)
> 
> diff --git a/www/window/SyncJobEdit.js b/www/window/SyncJobEdit.js
> index bcd2f2fb2..f980a2efd 100644
> --- a/www/window/SyncJobEdit.js
> +++ b/www/window/SyncJobEdit.js
> @@ -86,6 +86,13 @@ Ext.define('PBS.window.SyncJobEdit', {
>   	} else {
>   	    values.location = 'remote';
>   	}
> +	if (values['rate-out'] && me.syncDirection === 'push') {
> +	    values['rate-limit'] = values['rate-out'];
> +	    delete values['rate-out'];
> +	} else if (values['rate-in']) {
> +	    values['rate-limit'] = values['rate-in'];
> +	    delete values['rate-in'];
> +	}
>   	me.callParent([values]);
>       },
>   
> @@ -103,8 +110,15 @@ Ext.define('PBS.window.SyncJobEdit', {
>   		    if (!values.id && me.up('pbsSyncJobEdit').isCreate) {
>   			values.id = 's-' + Ext.data.identifier.Uuid.Global.generate().slice(0, 13);
>   		    }
> +		    if (values['rate-limit'] && me.syncDirection === 'push') {
> +			values['rate-out'] = values['rate-limit'];
> +		    } else {
> +			values['rate-in'] = values['rate-limit'];
> +		    }
> +		    delete values['rate-limit'];
>   		    if (!me.isCreate) {
>   			PBS.Utils.delete_if_default(values, 'rate-in');
> +			PBS.Utils.delete_if_default(values, 'rate-out');

this now deletes values set in the backend, or not?

e.g. i had set
rate-in: 10
rate-out: 15

then i update the config in the GUI and depending on the sync job direction,
the other gets deleted from the config.
(that's one reason where a single rate limit setting would make sense)

>   			PBS.Utils.delete_if_default(values, 'remote');
>   			if (typeof values.delete === 'string') {
>   			    values.delete = values.delete.split(',');
> @@ -185,7 +199,7 @@ Ext.define('PBS.window.SyncJobEdit', {
>   		    },
>   		    {
>   			xtype: 'pmxBandwidthField',
> -			name: 'rate-in',
> +			name: 'rate-limit',
>   			fieldLabel: gettext('Rate Limit'),
>   			emptyText: gettext('Unlimited'),
>   			submitAutoScaledSizeUnit: true,
> @@ -221,7 +235,7 @@ Ext.define('PBS.window.SyncJobEdit', {
>   				let me = this;
>   				let form = me.up('pbsSyncJobEdit');
>   				let nsField = form.down('field[name=remote-ns]');
> -				let rateLimitField = form.down('field[name=rate-in]');
> +				let rateLimitField = form.down('field[name=rate-limit]');
>   				let remoteField = form.down('field[name=remote]');
>   				let storeField = form.down('field[name=remote-store]');
>   
> @@ -263,7 +277,7 @@ Ext.define('PBS.window.SyncJobEdit', {
>   				let me = this;
>   				let remoteStoreField = me.up('pbsSyncJobEdit').down('field[name=remote-store]');
>   				remoteStoreField.setRemote(value);
> -				let rateLimitField = me.up('pbsSyncJobEdit').down('field[name=rate-in]');
> +				let rateLimitField = me.up('pbsSyncJobEdit').down('field[name=rate-limit]');
>   				rateLimitField.setDisabled(!value);
>   				if (!value) {
>   				    rateLimitField.setValue(null);



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