@@ -516,6 +516,7 @@ sub computeChecksum {
516
516
$postpone = 0 unless $self -> getFormat() eq ' json' ;
517
517
518
518
my $save_state = 0;
519
+ my @delete_sections ;
519
520
foreach my $section (@checked_sections ) {
520
521
my ($sha , $len ) = _checksum($section , $self -> {content }-> {$section });
521
522
my $state = $last_state -> get($section );
@@ -524,6 +525,8 @@ sub computeChecksum {
524
525
$logger -> debug(" Section $section has disappeared since last inventory" );
525
526
$last_state -> delete ($section );
526
527
$save_state ++;
528
+ # On missing section, a full inventory must be submitted
529
+ $postpone = 0;
527
530
}
528
531
next ;
529
532
}
@@ -535,10 +538,9 @@ sub computeChecksum {
535
538
defined ($state -> {len }) && $state -> {len } == $len &&
536
539
defined ($state -> {digest }) && $state -> {digest } eq $digest
537
540
) {
538
- # If we can postpone full inventory, remove section and set inventory as partial
541
+ # In the case we will be able to postpone full inventory, keep section as to be removed
539
542
if ($postpone && !$always_keep_sections {$section }) {
540
- delete $self -> {content }-> {$section };
541
- $self -> isPartial(1);
543
+ push @delete_sections , $section ;
542
544
}
543
545
next ;
544
546
}
@@ -555,6 +557,14 @@ sub computeChecksum {
555
557
$save_state ++;
556
558
}
557
559
560
+ # If we can postpone full inventory, remove section and set inventory as partial
561
+ if ($postpone && @delete_sections ) {
562
+ foreach my $section (@delete_sections ) {
563
+ delete $self -> {content }-> {$section };
564
+ }
565
+ $self -> isPartial(1);
566
+ }
567
+
558
568
$logger -> debug(" Full inventory " .
559
569
($postpone_config && $self -> isPartial() ? " postponed: $postpone /$postpone_config " : " kept" )
560
570
);
0 commit comments