CPU priority reduced when compressing
gitea/vn-vmware/pipeline/head This commit looks good Details

This commit is contained in:
Juan Ferrer 2020-05-23 03:15:51 +02:00
parent 5c049af5ac
commit db07203605
2 changed files with 7 additions and 2 deletions

2
debian/changelog vendored
View File

@ -1,4 +1,4 @@
vn-vmware (1.1.20) stable; urgency=low
vn-vmware (1.1.21) stable; urgency=low
* Initial Release.

View File

@ -602,7 +602,7 @@ sub backup_machine() {
if (exists $config{pigz_processes}) {
$pigz_processes = $config{pigz_processes};
} else {
$pigz_processes = int(Sys::CPU::cpu_count()) - 2;
$pigz_processes = int(Sys::CPU::cpu_count());
}
$pigz_processes = max(1, $pigz_processes);
@ -618,12 +618,17 @@ sub backup_machine() {
log_message "Compressing with Gzip (using $pigz_processes processes) to TAR file.";
log_message $tar_command;
my $priority = getpriority(0, 0);
setpriority(0, 0, $priority + 10);
unless ($test) {
my $tar_status = system($tar_command);
unless ($tar_status == 0) {
die "An error occurred when trying to compress '$vm_name' machine files.";
}
}
setpriority(0, 0, $priority);
};
my $err = $@;