From f1684b68a439d7874d6e0fe7f05fc83fe70c81f7 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 --- 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 87b8c9feeba..c80c469dd76 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.25.1