[open-ils-commits] r7947 - trunk/Open-ILS/src/reporter

svn at svn.open-ils.org svn at svn.open-ils.org
Tue Oct 30 21:36:57 EDT 2007


Author: dbs
Date: 2007-10-30 21:22:18 -0400 (Tue, 30 Oct 2007)
New Revision: 7947

Modified:
   trunk/Open-ILS/src/reporter/clark-kent.pl
Log:
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).


Modified: trunk/Open-ILS/src/reporter/clark-kent.pl
===================================================================
--- trunk/Open-ILS/src/reporter/clark-kent.pl	2007-10-30 20:15:13 UTC (rev 7946)
+++ trunk/Open-ILS/src/reporter/clark-kent.pl	2007-10-31 01:22:18 UTC (rev 7947)
@@ -1,4 +1,5 @@
 #!/usr/bin/perl -w
+# vim:ts=4:noet:
 
 use strict;
 use diagnostics;
@@ -79,7 +80,7 @@
 
 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 @@
 	# 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 @@
 	} 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 = ?,



More information about the open-ils-commits mailing list