repopulate failures table when a failure is reported
authorAndrew Dunstan <andrew@dunslane.net>
Wed, 19 Jan 2011 03:37:14 +0000 (19:37 -0800)
committerAndrew Dunstan <andrew@dunslane.net>
Wed, 19 Jan 2011 03:37:14 +0000 (19:37 -0800)
cgi-bin/pgstatus.pl

index 52e02df30e74896cf63751783c175ec0cf219276..0c60f80793f43a81e9050f110383ef3f23e9da32 100755 (executable)
@@ -401,6 +401,16 @@ $db->do("delete from dashboard_mat");
 $db->do("insert into dashboard_mat select * from dashboard_mat_data");
 $db->commit;
 
+if ($stage ne 'OK')
+{
+       $db->begin_work;
+       # prevent occasional duplication by forcing serialization of this operation
+       $db->do("lock table nrecent_failures in share row exclusive mode");
+       $db->do("delete from nrecent_failures");
+       $db->do("insert into nrecent_failures select bs.sysname, bs.snapshot, bs.branch from build_status bs where bs.stage <> 'OK' and bs.snapshot > now() - interval '30 days'");
+       $db->commit;
+}
+
 $db->disconnect;
 
 print "Content-Type: text/plain\n\n";