From bfc1e3c226932df939b616603076120498cf74a5 Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Thu, 20 Apr 2023 15:53:10 +0000 Subject: [PATCH] Bug 32250: (follow-up) Commit background job to the DB We can't run a background job if it isn't in the database, however, this script runs with AutoCommit disabled. We need to enable it while generating the background job, then disable for the updates. I don't nkow if using a transaction would be preferable. I tried to solve this independently, but it requires consolidating the index requests to make this work easily Signed-off-by: David Nind Signed-off-by: Jonathan Druart Signed-off-by: Tomas Cohen Arazi --- misc/link_bibs_to_authorities.pl | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/misc/link_bibs_to_authorities.pl b/misc/link_bibs_to_authorities.pl index 87b8c9feeb..c80c469dd7 100755 --- a/misc/link_bibs_to_authorities.pl +++ b/misc/link_bibs_to_authorities.pl @@ -111,8 +111,9 @@ sub process_bibs { } if ( not $test_only ) { - $indexer->index_records( \@updated_biblios, "specialUpdate", "biblioserver" ); $dbh->commit; + $dbh->{AutoCommit} = 1; + $indexer->index_records( \@updated_biblios, "specialUpdate", "biblioserver" ); } my $headings_linked = 0; @@ -248,7 +249,9 @@ sub process_bib { sub print_progress_and_commit { my $recs = shift; $dbh->commit(); + $dbh->{AutoCommit} = 1; $indexer->index_records( \@updated_biblios, "specialUpdate", "biblioserver" ); + $dbh->{AutoCommit} = 0; @updated_biblios = (); print "... processed $recs records\n"; } -- 2.39.5