Skip to content

Commit 60aa62c

Browse files
committed
Bump the file size on change
Fix #34 Recent change in blead exposed a bug in `cPanel::StateFile::_resynch`. When using multiple cPanel::TaskQueue objects, communication between both objects and `resync` is based on timestamp and filesize to force reloading the cache. This change is introducing an additional field to the serialized data to bump the file size (and eventually rotate after reaching a certain size) on updates where there would be a no-size change. Refs: Perl/perl5#19532
1 parent 79674ac commit 60aa62c

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

lib/cPanel/TaskQueue.pm

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,8 @@ END { undef %valid_processors } # case CPANEL-10871 to avoid a SEGV during gl
317317
$self->{max_task_timeout} = $meta->{max_task_to} if $meta->{max_task_to} > 0;
318318
$self->{max_in_process} = $meta->{max_running} if $meta->{max_running} > 0;
319319
$self->{default_child_timeout} = $meta->{def_child_to} if $meta->{def_child_to} > 0;
320+
$self->{_bump_size} = $meta->{_bump_size} // '';
321+
320322
$self->{paused} = ( exists $meta->{paused} && $meta->{paused} ) ? 1 : 0;
321323
$self->{defer_obj} = exists $meta->{defer_obj} ? $meta->{defer_obj} : undef;
322324

@@ -355,7 +357,12 @@ END { undef %valid_processors } # case CPANEL-10871 to avoid a SEGV during gl
355357
deferral_queue => $self->{deferral_queue},
356358
paused => ( $self->{paused} ? 1 : 0 ),
357359
defer_obj => $self->{defer_obj},
360+
_bump_size => $self->{_bump_size} // '',
358361
};
362+
363+
$meta->{_bump_size} .= "x";
364+
$meta->{_bump_size} = 'x' if length $meta->{_bump_size} > 1_024;
365+
359366
return $self->_serializer()->save( $fh, $FILETYPE, $CACHE_VERSION, $meta );
360367
}
361368

0 commit comments

Comments
 (0)