From e5cb04208f2287f5ba4f0f70367c0f8190e0082e Mon Sep 17 00:00:00 2001 From: Ilion Beyst Date: Sun, 17 Jul 2022 18:23:24 +0200 Subject: allow disabling ranker in develpoment --- planetwars-server/src/lib.rs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'planetwars-server/src') diff --git a/planetwars-server/src/lib.rs b/planetwars-server/src/lib.rs index 8962c3e..7bc50f3 100644 --- a/planetwars-server/src/lib.rs +++ b/planetwars-server/src/lib.rs @@ -8,10 +8,10 @@ pub mod routes; pub mod schema; pub mod util; -use std::path::PathBuf; -use std::{net::SocketAddr, fs}; use std::ops::Deref; +use std::path::PathBuf; use std::sync::Arc; +use std::{fs, net::SocketAddr}; use bb8::{Pool, PooledConnection}; use bb8_diesel::{self, DieselConnectionManager}; @@ -56,6 +56,9 @@ pub struct GlobalConfig { /// secret admin password for internal docker login /// used to pull bots when running matches pub registry_admin_password: String, + + /// Whether to run the ranker + pub ranker_enabled: bool, } // TODO: do we still need this? Is there a better way? @@ -161,7 +164,9 @@ pub async fn run_app() { let db_pool = prepare_db(&global_config).await; init_directories(&global_config).unwrap(); - tokio::spawn(run_ranker(global_config.clone(), db_pool.clone())); + if global_config.ranker_enabled { + tokio::spawn(run_ranker(global_config.clone(), db_pool.clone())); + } tokio::spawn(run_registry(global_config.clone(), db_pool.clone())); let api_service = Router::new() -- cgit v1.2.3