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/modules/bot_api.rs | |
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/modules/bot_api.rs')
-rw-r--r-- | planetwars-server/src/modules/bot_api.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/planetwars-server/src/modules/bot_api.rs b/planetwars-server/src/modules/bot_api.rs index 962b33d..0ee9357 100644 --- a/planetwars-server/src/modules/bot_api.rs +++ b/planetwars-server/src/modules/bot_api.rs @@ -122,10 +122,10 @@ impl pb::bot_api_service_server::BotApiService for BotApiServer { version: opponent_bot_version, }, ]); - let created_match = run_match - .store_in_database(&conn) - .expect("failed to save match"); - run_match.spawn(self.conn_pool.clone()); + let (created_match, _) = run_match + .run(self.conn_pool.clone()) + .await + .expect("failed to create match"); Ok(Response::new(pb::CreatedMatch { match_id: created_match.base.id, |