#!/usr/bin/perl -w
+# vim:ts=4:noet:
use strict;
use diagnostics;
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');
# 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});
} 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 = ?,