[pve-devel] applied: [PATCH common] fix #1766: compare task starttime numerically

Thomas Lamprecht t.lamprecht at proxmox.com
Fri May 18 15:02:21 CEST 2018


On 5/16/18 8:54 AM, Wolfgang Bumiller wrote:
> Not only because <=> is correct, but using 'cmp' also has
> the side effect that it adds a string version to the
> variable and the API's json output turns into a string as
> well, and this only happens once a task has completed
> (while it's an integer while it's still running...)
> 
> Signed-off-by: Wolfgang Bumiller <w.bumiller at proxmox.com>
> ---
>  src/PVE/RESTEnvironment.pm | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/PVE/RESTEnvironment.pm b/src/PVE/RESTEnvironment.pm
> index ebf8a2e..32ffdd1 100644
> --- a/src/PVE/RESTEnvironment.pm
> +++ b/src/PVE/RESTEnvironment.pm
> @@ -270,7 +270,7 @@ sub active_workers  {
>  	}
>  
>  
> -	@ta = sort { $b->{starttime} cmp $a->{starttime} } @ta;
> +	@ta = sort { $b->{starttime} <=> $a->{starttime} } @ta;
>  
>  	my $save = defined($new_upid);
>  
> 





More information about the pve-devel mailing list