View | Details | Raw Unified | Return to bug 29325
Collapse All | Expand All

(-)a/C4/ImportBatch.pm (-6 / +4 lines)
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 ) {
(-)a/misc/commit_file.pl (-1 lines)
Lines 129-135 _SUMMARY_ Link Here
129
sub print_progress_and_commit {
129
sub print_progress_and_commit {
130
    my ( $recs, $schema ) = @_;
130
    my ( $recs, $schema ) = @_;
131
    print "... processed $recs records\n";
131
    print "... processed $recs records\n";
132
    $schema->txn_commit;
133
}
132
}
134
133
135
sub print_usage {
134
sub print_usage {
(-)a/tools/manage-marc-import.pl (-4 / +1 lines)
Lines 275-281 sub revert_batch { Link Here
275
            my $callback = sub { };
275
            my $callback = sub { };
276
            if ($runinbackground) {
276
            if ($runinbackground) {
277
                $job = put_in_background($import_batch_id);
277
                $job = put_in_background($import_batch_id);
278
                $callback = progress_callback( $job, $dbh );
278
                $callback = progress_callback( $job );
279
            }
279
            }
280
            (
280
            (
281
                $num_deleted,       $num_errors, $num_reverted,
281
                $num_deleted,       $num_errors, $num_reverted,
Lines 338-346 sub progress_callback { Link Here
338
    my $job = shift;
338
    my $job = shift;
339
    return sub {
339
    return sub {
340
        my $progress = shift;
340
        my $progress = shift;
341
        my $schema = shift;
342
        $job->progress($progress);
341
        $job->progress($progress);
343
        $schema->txn_commit;
344
    }
342
    }
345
}
343
}
346
344
347
- 

Return to bug 29325