db-campaign: load completed pilots in one query

Instead of issuing a query for every variant, we assemble a set of
variant ids and query `WHERE variant_id in (1,...)'. This has not only
the effect of higher optimization potential for the database, but also
the query is issued before any result can come back. This will avoid an
overfull receive queue within the job server.

Change-Id: I5b1c60f92b97741ce26d9e50760b601929cef44f
This commit is contained in:
Christian Dietrich
2014-08-25 13:30:41 +02:00
parent 0fb6653fa8
commit 61050b3760
2 changed files with 22 additions and 8 deletions

View File

@ -29,7 +29,7 @@ class DatabaseCampaign : public Campaign {
int fspmethod_id; // !< Which fspmethod should be put out to the clients
void collect_result_thread();
void load_completed_pilots(fail::Database::Variant);
void load_completed_pilots(std::vector<fail::Database::Variant> &);
unsigned existing_results_for_pilot(unsigned pilot_id);
#ifndef __puma