From a8b5049e64f9cb08f8e165d0737139dab74e3bce Mon Sep 17 00:00:00 2001 From: Andrew Dunstan Date: Wed, 14 Dec 2011 14:38:44 -0800 Subject: [PATCH] Use git snapshot instead of fixed 10 day timeout. The sanity checks made sure that an animal wasn't submitting a snapshot that was too old. But sometimes an old branch doesn't get any changes for more than 10 days. So accept a snapshot that is not more than 1 day older than the last known snapshot. Per complaint from Stefan. --- cgi-bin/pgstatus.pl | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/cgi-bin/pgstatus.pl b/cgi-bin/pgstatus.pl index 742732a..57a60ed 100755 --- a/cgi-bin/pgstatus.pl +++ b/cgi-bin/pgstatus.pl @@ -14,7 +14,7 @@ use vars qw($dbhost $dbname $dbuser $dbpass $dbport $all_stat $fail_stat $change_stat $green_stat $server_time $min_script_version $min_web_script_version - $default_host + $default_host $local_git_clone ); # force this before we do anything - even load modules @@ -182,7 +182,10 @@ map {tr/$@/+=/; $_ = decode_base64($_); } if ($log =~/Last file mtime in snapshot: (.*)/) { my $snaptime = parsedate($1); - if ($snaptime < (time - (10 * 86400))) + my $brch = $branch eq 'HEAD' ? 'master' : $branch; + my $last_branch_time = time - (30 * 86400); + $last_branch_time = `TZ=UTC GIT_DIR=$local_git_clone git log -1 --pretty=format:\%ct $brch`; + if ($snaptime < ($last_branch_time - 86400)) { print "Status: 493 snapshot too old: $1\nContent-Type: text/plain\n\n"; print "snapshot to old: $1\n"; -- 2.30.2