diff options
author | Ilion Beyst <ilion.beyst@gmail.com> | 2022-07-25 22:26:58 +0200 |
---|---|---|
committer | Ilion Beyst <ilion.beyst@gmail.com> | 2022-07-25 22:26:58 +0200 |
commit | c30222cf9a5f173f30e5b6193714401dc0e3569f (patch) | |
tree | 457a3461a3e2203a8aefaf0b3432a97c22e84101 /planetwars-server/src/modules | |
parent | 67276bd0bbac15fe087edafd59d164c686509b35 (diff) | |
download | planetwars.dev-c30222cf9a5f173f30e5b6193714401dc0e3569f.tar.xz planetwars.dev-c30222cf9a5f173f30e5b6193714401dc0e3569f.zip |
limit amount of matches used by ranker
Diffstat (limited to 'planetwars-server/src/modules')
-rw-r--r-- | planetwars-server/src/modules/ranking.rs | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/planetwars-server/src/modules/ranking.rs b/planetwars-server/src/modules/ranking.rs index d508d6c..cb699fe 100644 --- a/planetwars-server/src/modules/ranking.rs +++ b/planetwars-server/src/modules/ranking.rs @@ -11,7 +11,9 @@ use std::sync::Arc; use std::time::{Duration, Instant}; use tokio; +// TODO: put these in a config const RANKER_INTERVAL: u64 = 60; +const RANKER_NUM_MATCHES: i64 = 10_000; pub async fn run_ranker(config: Arc<GlobalConfig>, db_pool: DbPool) { // TODO: make this configurable @@ -80,7 +82,7 @@ struct MatchStats { } fn fetch_match_stats(db_conn: &PgConnection) -> QueryResult<HashMap<(i32, i32), MatchStats>> { - let matches = db::matches::list_matches(db_conn)?; + let matches = db::matches::list_matches(RANKER_NUM_MATCHES, db_conn)?; let mut match_stats = HashMap::<(i32, i32), MatchStats>::new(); for m in matches { |