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

(-)a/C4/ImportBatch.pm (-6 / +4 lines)
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 ) {
(-)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 277-283 sub revert_batch { Link Here
277
            my $callback = sub { };
277
            my $callback = sub { };
278
            if ($runinbackground) {
278
            if ($runinbackground) {
279
                $job = put_in_background($import_batch_id);
279
                $job = put_in_background($import_batch_id);
280
                $callback = progress_callback( $job, $dbh );
280
                $callback = progress_callback( $job );
281
            }
281
            }
282
            (
282
            (
283
                $num_deleted,       $num_errors, $num_reverted,
283
                $num_deleted,       $num_errors, $num_reverted,
Lines 345-353 sub progress_callback { Link Here
345
    my $job = shift;
345
    my $job = shift;
346
    return sub {
346
    return sub {
347
        my $progress = shift;
347
        my $progress = shift;
348
        my $schema = shift;
349
        $job->progress($progress);
348
        $job->progress($progress);
350
        $schema->txn_commit;
351
    }
349
    }
352
}
350
}
353
351
354
- 

Return to bug 29325