diff options
author | Ilion Beyst <ilion.beyst@gmail.com> | 2022-07-13 19:36:07 +0200 |
---|---|---|
committer | Ilion Beyst <ilion.beyst@gmail.com> | 2022-07-13 19:36:07 +0200 |
commit | 668409e76d8cc7797fe627b2e2c3d0223b3db684 (patch) | |
tree | 459aae72431fff6d2855422156c3c5640c929690 /planetwars-server/src/routes | |
parent | e69bd14f1d64b0d8b2438a40a069d3647c1edd73 (diff) | |
download | planetwars.dev-668409e76d8cc7797fe627b2e2c3d0223b3db684.tar.xz planetwars.dev-668409e76d8cc7797fe627b2e2c3d0223b3db684.zip |
refactor: unify match save and spawn
Diffstat (limited to 'planetwars-server/src/routes')
-rw-r--r-- | planetwars-server/src/routes/demo.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/planetwars-server/src/routes/demo.rs b/planetwars-server/src/routes/demo.rs index f9929f7..5ff02c7 100644 --- a/planetwars-server/src/routes/demo.rs +++ b/planetwars-server/src/routes/demo.rs @@ -46,7 +46,7 @@ pub async fn submit_bot( // TODO: can we recover from this? .expect("could not save bot code"); - let mut run_match = RunMatch::from_players(vec![ + let run_match = RunMatch::from_players(vec![ MatchPlayer::BotVersion { bot: None, version: player_bot_version.clone(), @@ -56,10 +56,10 @@ pub async fn submit_bot( version: opponent_bot_version.clone(), }, ]); - let match_data = run_match - .store_in_database(&conn) - .expect("failed to save match"); - run_match.spawn(pool.clone()); + let (match_data, _) = run_match + .run(pool.clone()) + .await + .expect("failed to run match"); // TODO: avoid clones let full_match_data = FullMatchData { |