api: machine versions: avoid pushing to array if new one is created anyway

Avoid pushing our array of downstream revisions to the array of
upstream machines if we create completely new array on return anyway,
just let sort iterate over both arrays instead.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Thomas Lamprecht 2025-04-06 19:09:34 +02:00
parent cc5dc71a7a
commit e0095011a7

View File

@ -79,9 +79,7 @@ __PACKAGE__->register_method({
}
}
push $machines->@*, $to_add->@*;
return [sort { $b->{id} cmp $a->{id} } $machines->@*];
return [ sort { $b->{id} cmp $a->{id} } ($machines->@*, $to_add->@*) ]; # merge & sort
};
die "could not load supported machine versions - $@\n" if $@;
return $supported_machine_list;