Even 20s is really long, but it cuts off queries which are today running for 500+s.
ADIHLAZIPFFSWEBJV4NWFP7S5QN4BLQFHLDPUZ436GP7W7NKQ7WAC
A5WCCKBZUQLCNW5FYRMEI2E5C4YPYWY4OX77IT5DRSNZ5NNOCGUQC
NZXX6PLDWEDQHXFF5JCZWGB22VA3WSDYLX65K6BQ5GNWPOE43N7QC
UICHT2PSN2QOCHP6MGY5QQJUDU4IF6FBIOJLBA55QBJDK6ST566AC
J5UVLXOK6EDIL5I7VKWH4V2QDS4DPD7FHRK6XBWSXFRQS4JKXFZQC
GK326R5NJYVROQQUOBQT26P3OV6OZLMLTZRU6VIDR2HEOOTRAGAQC
WUCOEIFANBM3WXZ2IWEITZ6FKBKXASVWH2LCYRXB4C22H5ADLWVAC
LCLXI7PTVYQLR2SGXVIAJCLKW3H2TTM3UVJSZHAO7VMISNIHTXOQC
EJ7C77C3QLT7JPRHFTDIOY4WAXPXAXMAPWJYWEPKGPO5CCGD3SZAC
FHOH54HQJOWN2HGIKLVADURVYYHIIORLKEFI4NVKE4K457GLG6CAC
E7OGIRKLEKZXSSFAO3Z6DSZJ5X5YNPMA2KBLCPJ4YBFAWCVXSB2AC
MIMHJSZKFRNIKCYWQQDITZFPY6L2P43BSBPFERK3633CFDQY7YDAC
TX7Q4RASUYPTHIHZFACQ227BIZYLNJGRA5HHIAFQWCL4FHEHVGPQC
$c->stash->{projects} = [ $c->model('DB::Projects')->search(
{ -and =>
[ { -or => [ name => { ilike => "%$query%" }, displayName => { ilike => "%$query%" }, description => { ilike => "%$query%" } ] }
, { hidden => 0 }
]
},
{ order_by => ["name"] } ) ];
$c->model('DB')->schema->txn_do(sub {
$c->model('DB')->schema->storage->dbh->do("SET LOCAL statement_timeout = 20000");
$c->stash->{projects} = [ $c->model('DB::Projects')->search(
{ -and =>
[ { -or => [ name => { ilike => "%$query%" }, displayName => { ilike => "%$query%" }, description => { ilike => "%$query%" } ] }
, { hidden => 0 }
]
},
{ order_by => ["name"] } ) ];
$c->stash->{jobsets} = [ $c->model('DB::Jobsets')->search(
{ -and =>
[ { -or => [ "me.name" => { ilike => "%$query%" }, "me.description" => { ilike => "%$query%" } ] }
, { "project.hidden" => 0, "me.hidden" => 0 }
]
},
{ order_by => ["project", "name"], join => ["project"] } ) ];
$c->stash->{jobsets} = [ $c->model('DB::Jobsets')->search(
{ -and =>
[ { -or => [ "me.name" => { ilike => "%$query%" }, "me.description" => { ilike => "%$query%" } ] }
, { "project.hidden" => 0, "me.hidden" => 0 }
]
},
{ order_by => ["project", "name"], join => ["project"] } ) ];
$c->stash->{jobs} = [ $c->model('DB::Builds')->search(
{ "job" => { ilike => "%$query%" }
, "project.hidden" => 0
, "jobset.hidden" => 0
, iscurrent => 1
},
{ order_by => ["project", "jobset", "job"], join => ["project", "jobset"]
, rows => $c->stash->{limit} + 1
} )
];
$c->stash->{jobs} = [ $c->model('DB::Builds')->search(
{ "job" => { ilike => "%$query%" }
, "project.hidden" => 0
, "jobset.hidden" => 0
, iscurrent => 1
},
{ order_by => ["project", "jobset", "job"], join => ["project", "jobset"]
, rows => $c->stash->{limit} + 1
} )
];
# Perform build search in separate queries to prevent seq scan on buildoutputs table.
$c->stash->{builds} = [ $c->model('DB::Builds')->search(
{ "buildoutputs.path" => { ilike => "%$query%" } },
{ order_by => ["id desc"], join => ["buildoutputs"]
, rows => $c->stash->{limit}
} ) ];
# Perform build search in separate queries to prevent seq scan on buildoutputs table.
$c->stash->{builds} = [ $c->model('DB::Builds')->search(
{ "buildoutputs.path" => { ilike => "%$query%" } },
{ order_by => ["id desc"], join => ["buildoutputs"]
, rows => $c->stash->{limit}
} ) ];
$c->stash->{buildsdrv} = [ $c->model('DB::Builds')->search(
{ "drvpath" => { ilike => "%$query%" } },
{ order_by => ["id desc"]
, rows => $c->stash->{limit}
} ) ];
$c->stash->{buildsdrv} = [ $c->model('DB::Builds')->search(
{ "drvpath" => { ilike => "%$query%" } },
{ order_by => ["id desc"]
, rows => $c->stash->{limit}
} ) ];
$c->stash->{resource} = { projects => $c->stash->{projects},
jobsets => $c->stash->{jobsets},
builds => $c->stash->{builds},
buildsdrv => $c->stash->{buildsdrv} };
$c->stash->{resource} = { projects => $c->stash->{projects},
jobsets => $c->stash->{jobsets},
builds => $c->stash->{builds},
buildsdrv => $c->stash->{buildsdrv} };
});