From 7d48e761d7c16b0834bb7f6c42a86b70e599eedb Mon Sep 17 00:00:00 2001 From: dbs Date: Wed, 31 Oct 2007 01:22:18 +0000 Subject: [PATCH] Set AutoCommit explicitly on, and don't rollback in the exception handler unless AutoCommit has been turned off (to avoid annoying warnings being dumped to stderr). git-svn-id: svn://svn.open-ils.org/ILS/trunk@7947 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/src/reporter/clark-kent.pl | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Open-ILS/src/reporter/clark-kent.pl b/Open-ILS/src/reporter/clark-kent.pl index a3606ec3f9..bde2844800 100755 --- a/Open-ILS/src/reporter/clark-kent.pl +++ b/Open-ILS/src/reporter/clark-kent.pl @@ -1,4 +1,5 @@ #!/usr/bin/perl -w +# vim:ts=4:noet: use strict; use diagnostics; @@ -79,7 +80,7 @@ if ($daemon) { DAEMON: -$dbh = DBI->connect($dsn,$db_user,$db_pw, {pg_enable_utf8 => 1, RaiseError => 1}); +$dbh = DBI->connect($dsn,$db_user,$db_pw, {AutoCommit => 1, pg_enable_utf8 => 1, RaiseError => 1}); $current_time = DateTime->from_epoch( epoch => time() )->strftime('%FT%T%z'); @@ -148,7 +149,7 @@ for my $r ( @reports ) { # This is the child (runner) process; daemonize("Clark Kent reporting: $r->{report}->{name}"); - $dbh = DBI->connect($dsn,$db_user,$db_pw, {pg_enable_utf8 => 1, RaiseError => 1}); + $dbh = DBI->connect($dsn,$db_user,$db_pw, {AutoCommit => 1, pg_enable_utf8 => 1, RaiseError => 1}); try { $dbh->do(<<' SQL',{}, $r->{id}); @@ -260,7 +261,9 @@ for my $r ( @reports ) { } otherwise { my $e = shift; $r->{error_text} = ''.$e; - $dbh->rollback; + if (!$dbh->{AutoCommit}) { + $dbh->rollback; + } $dbh->do(<<' SQL',{}, $e, $r->{id}); UPDATE reporter.schedule SET error_text = ?, -- 2.11.0