From 2abaa3e3cbcf431d35a2807ae30b0d6f9172ec1c Mon Sep 17 00:00:00 2001 From: Andrew Dunstan Date: Tue, 18 Jan 2011 19:37:14 -0800 Subject: [PATCH] repopulate failures table when a failure is reported --- cgi-bin/pgstatus.pl | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/cgi-bin/pgstatus.pl b/cgi-bin/pgstatus.pl index 52e02df..0c60f80 100755 --- a/cgi-bin/pgstatus.pl +++ b/cgi-bin/pgstatus.pl @@ -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"; -- 2.30.2