aboutsummaryrefslogtreecommitdiff
path: root/planetwars-server/src/modules/bot_api.rs
diff options
context:
space:
mode:
authorIlion Beyst <ilion.beyst@gmail.com>2022-07-13 19:36:07 +0200
committerIlion Beyst <ilion.beyst@gmail.com>2022-07-13 19:36:07 +0200
commit668409e76d8cc7797fe627b2e2c3d0223b3db684 (patch)
tree459aae72431fff6d2855422156c3c5640c929690 /planetwars-server/src/modules/bot_api.rs
parente69bd14f1d64b0d8b2438a40a069d3647c1edd73 (diff)
downloadplanetwars.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.rs8
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,