mirror of
https://github.com/Steffo99/distributed-arcade.git
synced 2024-11-21 23:54:25 +00:00
route_board_post
: Start transaction earlier to account for empty key checks
This commit is contained in:
parent
7555b10a06
commit
2b95aea509
1 changed files with 5 additions and 4 deletions
|
@ -141,6 +141,11 @@ pub(crate) async fn route_board_post(
|
||||||
let mut rconn = rclient.get_connection_or_504().await?;
|
let mut rconn = rclient.get_connection_or_504().await?;
|
||||||
|
|
||||||
log::trace!("Ensuring a board does not already exist...");
|
log::trace!("Ensuring a board does not already exist...");
|
||||||
|
|
||||||
|
log::trace!("Starting Redis transaction...");
|
||||||
|
redis::cmd("MULTI").query_async(&mut rconn).await
|
||||||
|
.map_err(outcome::redis_cmd_failed)?;
|
||||||
|
|
||||||
ensure_key_is_empty(&mut rconn, &order_key).await?;
|
ensure_key_is_empty(&mut rconn, &order_key).await?;
|
||||||
ensure_key_is_empty(&mut rconn, &token_key).await?;
|
ensure_key_is_empty(&mut rconn, &token_key).await?;
|
||||||
ensure_key_is_empty(&mut rconn, &scores_key).await?;
|
ensure_key_is_empty(&mut rconn, &scores_key).await?;
|
||||||
|
@ -149,10 +154,6 @@ pub(crate) async fn route_board_post(
|
||||||
|
|
||||||
log::debug!("Creating board: {name:?}");
|
log::debug!("Creating board: {name:?}");
|
||||||
|
|
||||||
log::trace!("Starting Redis transaction...");
|
|
||||||
redis::cmd("MULTI").query_async(&mut rconn).await
|
|
||||||
.map_err(outcome::redis_cmd_failed)?;
|
|
||||||
|
|
||||||
log::trace!("Setting board order...");
|
log::trace!("Setting board order...");
|
||||||
rconn.set(&order_key, Into::<&str>::into(order)).await
|
rconn.set(&order_key, Into::<&str>::into(order)).await
|
||||||
.map_err(outcome::redis_cmd_failed)?;
|
.map_err(outcome::redis_cmd_failed)?;
|
||||||
|
|
Loading…
Reference in a new issue