From: Thomas Lamprecht <t.lamprecht@proxmox.com>
To: Proxmox Backup Server development discussion
<pbs-devel@lists.proxmox.com>,
Dominik Csapak <d.csapak@proxmox.com>
Subject: Re: [pbs-devel] [PATCH proxmox-backup 1/2] api2/status: fix estimation bug
Date: Mon, 20 Jul 2020 11:36:39 +0200 [thread overview]
Message-ID: <a1f760bc-f5d6-edb7-3fae-01f74b8b5207@proxmox.com> (raw)
In-Reply-To: <20200717133917.4621-1-d.csapak@proxmox.com>
On 17.07.20 15:39, Dominik Csapak wrote:
> when a datastore has enough data to calculate the estimated full date,
> but always has exactly the same usage, the factor b of the regression
> is '0'
>
> return 0 for that case so that the gui can show 'never' instead of
> 'not enough data'
>
> Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
> ---
> src/api2/status.rs | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/src/api2/status.rs b/src/api2/status.rs
> index 34e0505..4f98543 100644
> --- a/src/api2/status.rs
> +++ b/src/api2/status.rs
> @@ -161,6 +161,8 @@ fn datastore_status(
> if b != 0.0 {
> let estimate = (1.0 - a) / b;
> entry["estimated-full-date"] = Value::from(estimate.floor() as u64);
> + } else {
> + entry["estimated-full-date"] = Value::from(0);
> }
> }
> }
>
nit and asking mostly out of interest, but wouldn't it be more "idomatic rust" if this
was written like:
entry["estimated-full-date"] = if b != 0.0 {
let estimate = (1.0 - a) / b;
Value::from(estimate.floor() as u64)
} else {
Value::from(0)
}
anyway, looks OK to me from a quick look.
next prev parent reply other threads:[~2020-07-20 9:36 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-17 13:39 Dominik Csapak
2020-07-17 13:39 ` [pbs-devel] [PATCH proxmox-backup 2/2] examples/upload-speed: adapt to change Dominik Csapak
2020-07-20 8:22 ` [pbs-devel] applied: " Fabian Grünbichler
2020-07-20 9:36 ` Thomas Lamprecht [this message]
2020-07-20 14:37 ` [pbs-devel] [PATCH proxmox-backup 1/2] api2/status: fix estimation bug Dominik Csapak
2020-07-20 14:48 ` Thomas Lamprecht
2020-07-21 11:10 ` [pbs-devel] applied: " 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=a1f760bc-f5d6-edb7-3fae-01f74b8b5207@proxmox.com \
--to=t.lamprecht@proxmox.com \
--cc=d.csapak@proxmox.com \
--cc=pbs-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