]> ruin.nu Git - ndwebbie.git/commitdiff
Hopefully will catch the problem that was this morning
authorMichael Andreen <harv@ruin.nu>
Mon, 7 Apr 2008 20:06:08 +0000 (22:06 +0200)
committerMichael Andreen <harv@ruin.nu>
Mon, 7 Apr 2008 20:06:08 +0000 (22:06 +0200)
scripts/scans.pl

index b297e9113d12e232bec425c9ee360f67d4e6e61a..01560796b13a5ae9cffa733f01cf42596cb69c7f 100755 (executable)
@@ -75,9 +75,9 @@ my $fleetscan = $dbh->prepare(q{INSERT INTO fleet_scans (id,scan) VALUES(?,?)});
 my $addships = $dbh->prepare(q{INSERT INTO fleet_ships (id,ship,amount) VALUES(?,?,?)});
 my $addpdata = $dbh->prepare(q{INSERT INTO planet_data (id,tick,scan,rid,amount) VALUES(?,?,?,(SELECT id FROM planet_data_types WHERE category = ? AND name = ?), ?)});
 
-$dbh->begin_work;
+$dbh->begin_work or die 'No transaction';
 $newscans->execute or die $dbh->errstr;
-$dbh->pg_savepoint('scans');
+$dbh->pg_savepoint('scans') or die "No savepoint";
 while (my $scan = $newscans->fetchrow_hashref){
        my $file = get("http://game.planetarion.com/showscan.pl?scan_id=$scan->{scan_id}");
        next unless defined $file;
@@ -172,12 +172,12 @@ while (my $scan = $newscans->fetchrow_hashref){
                        print "Something wrong with scan $scan->{id} type $type at tick $tick http://game.planetarion.com/showscan.pl?scan_id=$scan->{scan_id}";
                }
                $parsedscan->execute($tick,$type,$planet,$scan->{id}) or die $dbh->errstr;
-               $dbh->pg_savepoint('scans');
+               $dbh->pg_savepoint('scans') or die "Couldn't save";
                #$dbh->rollback;
                };
                if ($@) {
                        warn $@;
-                       $dbh->pg_rollback_to('scans');
+                       $dbh->pg_rollback_to('scans') or die "rollback didn't work";
                }
        }else{
                warn "Nothing useful in scan: $scan->{id} http://game.planetarion.com/showscan.pl?scan_id=$scan->{scan_id}\n";