to get the current replication config and have the VM list
and state object as recent as possible.

Suggested-by: Fabian Grünbichler <f.gruenbich...@proxmox.com>
Signed-off-by: Fabian Ebner <f.eb...@proxmox.com>
---
 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};
-- 
2.20.1



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to