Use new style Retry in CopyRowsInsertSelect.pm.

This commit is contained in:
Daniel Nichter
2011-11-02 10:05:48 -06:00
parent 348fe17038
commit 2e72da5717

View File

@@ -85,24 +85,23 @@ sub copy {
wait => sub { sleep 1; }, wait => sub { sleep 1; },
tries => 3, tries => 3,
try => sub { try => sub {
my ( %args ) = @_; $dbh->do($sql);
eval { return;
$dbh->do($sql); },
}; fail => sub {
if ( $EVAL_ERROR ) { my (%args) = @_;
MKDEBUG && _d($EVAL_ERROR); my $error = $args{error};
if ( $EVAL_ERROR =~ m/Lock wait timeout exceeded/ ) { MKDEBUG && _d($error);
$error = $EVAL_ERROR; if ( $error =~ m/Lock wait timeout exceeded/ ) {
if ( $args{tryno} > 1 ) { $msg->("Lock wait timeout exceeded; retrying $sql");
$msg->("Lock wait timeout exceeded; retrying $sql"); return 1; # call wait, call try
} }
return; return 0; # call final_fail
} },
die $EVAL_ERROR; final_fail => sub {
} my (%args) = @_;
return 1; die $args{error};
}, },
on_failure => sub { die $error; },
); );
} }