Lines 612-629
sub BatchCommitRecords {
Link Here
|
612 |
|
612 |
|
613 |
my $rec_num = 0; |
613 |
my $rec_num = 0; |
614 |
my @biblio_ids; |
614 |
my @biblio_ids; |
|
|
615 |
$schema->txn_begin; # We commit in a transaction |
615 |
while (my $rowref = $sth->fetchrow_hashref) { |
616 |
while (my $rowref = $sth->fetchrow_hashref) { |
616 |
$record_type = $rowref->{'record_type'}; |
617 |
$record_type = $rowref->{'record_type'}; |
617 |
|
618 |
|
618 |
# first record, begin transaction |
|
|
619 |
$schema->txn_begin |
620 |
unless $rec_num; |
621 |
|
622 |
$rec_num++; |
619 |
$rec_num++; |
623 |
|
620 |
|
624 |
if ($progress_interval and (0 == ($rec_num % $progress_interval))) { |
621 |
if ($progress_interval and (0 == ($rec_num % $progress_interval))) { |
625 |
# report progress and commit |
622 |
# report progress and commit |
626 |
&$progress_callback($rec_num, $schema); |
623 |
$schema->txn_commit; |
|
|
624 |
&$progress_callback( $rec_num ); |
627 |
$schema->txn_begin; |
625 |
$schema->txn_begin; |
628 |
} |
626 |
} |
629 |
if ($rowref->{'status'} eq 'error' or $rowref->{'status'} eq 'imported') { |
627 |
if ($rowref->{'status'} eq 'error' or $rowref->{'status'} eq 'imported') { |
Lines 749-755
sub BatchCommitRecords {
Link Here
|
749 |
SetImportRecordStatus($rowref->{'import_record_id'}, 'ignored'); |
747 |
SetImportRecordStatus($rowref->{'import_record_id'}, 'ignored'); |
750 |
} |
748 |
} |
751 |
} |
749 |
} |
752 |
&$progress_callback($rec_num, $schema); # Make sure to commit the final chunk that didn't hit the commit threshhold |
750 |
$schema->txn_commit; # Commit final records that may not have hit callback threshhold |
753 |
$sth->finish(); |
751 |
$sth->finish(); |
754 |
|
752 |
|
755 |
if ( @biblio_ids ) { |
753 |
if ( @biblio_ids ) { |