From db9eb287d4ec0958fcc8912f45292e4872abf53c Mon Sep 17 00:00:00 2001 From: Fabian Ebner Date: Thu, 29 Oct 2020 14:31:25 +0100 Subject: [PATCH] job_status: read only after acquiring the lock MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit to get the current replication config and have the VM list and state object as recent as possible. Suggested-by: Fabian Grünbichler Signed-off-by: Fabian Ebner --- PVE/ReplicationState.pm | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/PVE/ReplicationState.pm b/PVE/ReplicationState.pm index 057cae6..80d45d6 100644 --- a/PVE/ReplicationState.pm +++ b/PVE/ReplicationState.pm @@ -234,13 +234,11 @@ sub job_status { my $jobs = {}; - my $stateobj = read_state(); - - my $cfg = PVE::ReplicationConfig->new(); - - my $vms = PVE::Cluster::get_vmlist(); - my $func = sub { + my $stateobj = read_state(); + my $cfg = PVE::ReplicationConfig->new(); + my $vms = PVE::Cluster::get_vmlist(); + foreach my $jobid (sort keys %{$cfg->{ids}}) { my $jobcfg = $cfg->{ids}->{$jobid}; my $vmid = $jobcfg->{guest};