File tree Expand file tree Collapse file tree 1 file changed +31
-15
lines changed
Expand file tree Collapse file tree 1 file changed +31
-15
lines changed Original file line number Diff line number Diff line change @@ -313,9 +313,8 @@ sub with_our_config {
313313 $code -> ($self );
314314}
315315
316- sub test_reindex {
317- my ($self , $arg ) = @_ ;
318- $arg //= {};
316+ sub _take_pause_action {
317+ my ($self , $action ) = @_ ;
319318
320319 $self -> with_our_config(sub {
321320 my $self = shift ;
@@ -349,18 +348,7 @@ sub test_reindex {
349348
350349 die " stray mail in test mail trap before reindex" if @stray_mail ;
351350
352- if ($arg -> {pick }) {
353- my $dbh = PAUSE::dbh();
354- $dbh -> do(" DELETE FROM distmtimes WHERE dist = ?" , undef , $_ )
355- for @{ $arg -> {pick } };
356- }
357-
358- PAUSE::mldistwatch-> new({
359- sleep => 0,
360- ($arg -> {pick } ? (pick => $arg -> {pick }) : ()),
361- })-> reindex;
362-
363- $arg -> {after }-> ($self -> tmpdir) if $arg -> {after };
351+ $action -> ();
364352
365353 my @deliveries = Email::Sender::Simple-> default_transport-> deliveries;
366354
@@ -376,6 +364,34 @@ sub test_reindex {
376364 });
377365}
378366
367+ sub rewrite_indexes {
368+ my ($self ) = @_ ;
369+ my $action = sub {
370+ PAUSE::mldistwatch-> new({ sleep => 0 })-> rewrite_indexes;
371+ };
372+
373+ return $self -> _take_pause_action($action );
374+ }
375+
376+ sub test_reindex {
377+ my ($self , $arg ) = @_ ;
378+ $arg //= {};
379+ my $action = sub {
380+ if ($arg -> {pick }) {
381+ my $dbh = PAUSE::dbh();
382+ $dbh -> do(" DELETE FROM distmtimes WHERE dist = ?" , undef , $_ )
383+ for @{ $arg -> {pick } };
384+ }
385+
386+ PAUSE::mldistwatch-> new({
387+ sleep => 0,
388+ ($arg -> {pick } ? (pick => $arg -> {pick }) : ()),
389+ })-> reindex;
390+ };
391+
392+ return $self -> _take_pause_action($action );
393+ }
394+
379395has _file_index => (
380396 is => ' ro' ,
381397 default => sub { {} },
You can’t perform that action at this time.
0 commit comments