forked from lix-project/hydra
Split timeSpent query into 2 separate queries, as postgresql isn't able to figure out a decent query plan. With 120k jobs in queue, this makes some queries go from 100s to 1-2s.
This commit is contained in:
parent
d9ab964203
commit
e003665146
|
@ -148,7 +148,14 @@ sub checkBuilds {
|
|||
if (!defined $timeSpent) {
|
||||
$timeSpent = $jobset->builds->search(
|
||||
{ },
|
||||
{ where => \ ("(finished = 0 or (me.stoptime >= " . (time() - $windowSize) . "))")
|
||||
{ where => \ ("(finished = 0)")
|
||||
, join => 'buildsteps'
|
||||
, select => \ "sum(coalesce(buildsteps.stoptime, ${\time}) - buildsteps.starttime)"
|
||||
, as => "sum" })->single->get_column("sum") // 0;
|
||||
|
||||
$timeSpent += $jobset->builds->search(
|
||||
{ },
|
||||
{ where => \ ("(me.stoptime >= " . (time() - $windowSize) . ")")
|
||||
, join => 'buildsteps'
|
||||
, select => \ "sum(coalesce(buildsteps.stoptime, ${\time}) - buildsteps.starttime)"
|
||||
, as => "sum" })->single->get_column("sum") // 0;
|
||||
|
|
Loading…
Reference in a new issue