From 018585dba82847f97f4168d35b3452d3797bf81d Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 22 Apr 2009 13:55:20 +0000 Subject: [PATCH] * In the job status page and the channels, pick the build with the highest ID rather than the highest timestamp. Otherwise, if a build from revision N finishes after a build from revision N + 1, then the build from revision N will end up in the channel. Thus, the channel contents will be out of sync. This is still not quite correct: if a revision *reverts* to an older build, the channel will still end up out of sync, because Hydra won't schedule the build again (after all, it has already done it). A better fix would be to add a separate timestamp denoting when the build was last "current" (i.e. corresponding to the "head revision" of its job). --- src/lib/Hydra/Schema/Builds.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib/Hydra/Schema/Builds.pm b/src/lib/Hydra/Schema/Builds.pm index eea2e6d5..319c2026 100644 --- a/src/lib/Hydra/Schema/Builds.pm +++ b/src/lib/Hydra/Schema/Builds.pm @@ -114,8 +114,8 @@ sub makeSource { sub makeQueries { my ($name, $constraint) = @_; - makeSource('JobStatus' . $name, "select * from (select project, jobset, job, system, max(timestamp) timestamp from Builds where finished = 1 $constraint group by project, jobset, job, system) natural join Builds"); - makeSource('LatestSucceeded' . $name, "select * from (select project, jobset, job, system, max(timestamp) timestamp from Builds natural join BuildResultInfo where finished = 1 and buildStatus = 0 $constraint group by project, jobset, job, system) natural join Builds"); + makeSource('JobStatus' . $name, "select * from (select project, jobset, job, system, max(id) id from Builds where finished = 1 $constraint group by project, jobset, job, system) natural join Builds"); + makeSource('LatestSucceeded' . $name, "select * from (select project, jobset, job, system, max(id) id from Builds natural join BuildResultInfo where finished = 1 and buildStatus = 0 $constraint group by project, jobset, job, system) natural join Builds"); } makeQueries('', "");