mirror of
git://git.proxmox.com/git/pve-common.git
synced 2025-02-08 13:57:22 +03:00
Daemon: do not wait for lock on restart
This commit is contained in:
parent
c56111950d
commit
48876459cb
@ -65,12 +65,15 @@ my $lockpidfile = sub {
|
||||
|
||||
my $lkfn = $self->{pidfile} . ".lock";
|
||||
|
||||
my $waittime = 0;
|
||||
|
||||
if (my $fd = $self->{env_pve_lock_fd}) {
|
||||
|
||||
$self->{daemon_lock_fh} = IO::Handle->new_from_fd($fd, "a");
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
$waittime = 5;
|
||||
$self->{daemon_lock_fh} = IO::File->new(">>$lkfn");
|
||||
}
|
||||
|
||||
@ -78,7 +81,7 @@ my $lockpidfile = sub {
|
||||
die "can't open lock '$lkfn' - $!\n";
|
||||
}
|
||||
|
||||
for (my $i = 0; $i < 5; $i ++) {
|
||||
for (my $i = 0; $i < $waittime; $i ++) {
|
||||
return if flock ($self->{daemon_lock_fh}, LOCK_EX|LOCK_NB);
|
||||
sleep(1);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user