Lines 583-600
sub BatchCommitRecords {
Link Here
|
583 |
|
583 |
|
584 |
my $rec_num = 0; |
584 |
my $rec_num = 0; |
585 |
my @biblio_ids; |
585 |
my @biblio_ids; |
|
|
586 |
$schema->txn_begin; # We commit in a transaction |
586 |
while (my $rowref = $sth->fetchrow_hashref) { |
587 |
while (my $rowref = $sth->fetchrow_hashref) { |
587 |
$record_type = $rowref->{'record_type'}; |
588 |
$record_type = $rowref->{'record_type'}; |
588 |
|
589 |
|
589 |
# first record, begin transaction |
|
|
590 |
$schema->txn_begin |
591 |
unless $rec_num; |
592 |
|
593 |
$rec_num++; |
590 |
$rec_num++; |
594 |
|
591 |
|
595 |
if ($progress_interval and (0 == ($rec_num % $progress_interval))) { |
592 |
if ($progress_interval and (0 == ($rec_num % $progress_interval))) { |
596 |
# report progress and commit |
593 |
# report progress and commit |
597 |
&$progress_callback($rec_num, $schema); |
594 |
$schema->txn_commit; |
|
|
595 |
&$progress_callback( $rec_num ); |
598 |
$schema->txn_begin; |
596 |
$schema->txn_begin; |
599 |
} |
597 |
} |
600 |
if ($rowref->{'status'} eq 'error' or $rowref->{'status'} eq 'imported') { |
598 |
if ($rowref->{'status'} eq 'error' or $rowref->{'status'} eq 'imported') { |
Lines 720-726
sub BatchCommitRecords {
Link Here
|
720 |
SetImportRecordStatus($rowref->{'import_record_id'}, 'ignored'); |
718 |
SetImportRecordStatus($rowref->{'import_record_id'}, 'ignored'); |
721 |
} |
719 |
} |
722 |
} |
720 |
} |
723 |
&$progress_callback($rec_num, $schema); # Make sure to commit the final chunk that didn't hit the commit threshhold |
721 |
$schema->txn_commit; # Commit final records that may not have hit callback threshold |
724 |
$sth->finish(); |
722 |
$sth->finish(); |
725 |
|
723 |
|
726 |
if ( @biblio_ids ) { |
724 |
if ( @biblio_ids ) { |