]> git.proxmox.com Git - pve-guest-common.git/blobdiff - PVE/ReplicationState.pm
PVE::ReplicationState - cleanup job state on job removal
[pve-guest-common.git] / PVE / ReplicationState.pm
index eeab4e8aedeadb9e043087cddb3104d4a1a781bb..5401db60f9dbb9f2df9189069a0c0cc2cfc84bcd 100644 (file)
@@ -158,12 +158,17 @@ sub record_job_end {
        chomp $err;
        $state->{fail_count}++;
        $state->{error} = "$err";
+       write_job_state($jobcfg,  $state);
     } else {
-       $state->{last_sync} = $start_time;
-       $state->{fail_count} = 0;
-       delete $state->{error};
+       if ($jobcfg->{remove_job}) {
+           write_job_state($jobcfg, undef);
+       } else {
+           $state->{last_sync} = $start_time;
+           $state->{fail_count} = 0;
+           delete $state->{error};
+           write_job_state($jobcfg,  $state);
+       }
     }
-    write_job_state($jobcfg,  $state);
 }
 
 sub replication_snapshot_name {