Skip to content

Commit

Permalink
fix: resolve actor create build tags to the env instead of game (#1430)
Browse files Browse the repository at this point in the history
<!-- Please make sure there is an issue that this PR is correlated to. -->

## Changes

<!-- If there are frontend changes, please include screenshots. -->
  • Loading branch information
NathanFlurry committed Nov 22, 2024
1 parent b2ad415 commit ad50f4a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
6 changes: 3 additions & 3 deletions packages/api/actor/src/route/actors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ pub async fn create(
ctx.op(ds::ops::game_config::get::Input {
game_ids: vec![game_id],
}),
resolve_build_id(&ctx, game_id, body.build, body.build_tags.flatten()),
resolve_build_id(&ctx, env_id, body.build, body.build_tags.flatten()),
)?;
let cluster_id = unwrap!(clusters_res.games.first()).cluster_id;
let game_config = unwrap!(game_configs_res.game_configs.first());
Expand Down Expand Up @@ -614,7 +614,7 @@ fn legacy_convert_actor_to_server(

async fn resolve_build_id(
ctx: &Ctx<Auth>,
game_id: Uuid,
env_id: Uuid,
build_id: Option<Uuid>,
build_tags: Option<serde_json::Value>,
) -> GlobalResult<Uuid> {
Expand All @@ -624,7 +624,7 @@ async fn resolve_build_id(
(None, Some(build_tags)) => {
let builds_res = ctx
.op(build::ops::resolve_for_tags::Input {
game_id: Some(game_id),
env_id,
tags: serde_json::from_value(build_tags)?,
})
.await?;
Expand Down
8 changes: 3 additions & 5 deletions packages/services/build/src/ops/resolve_for_tags.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use crate::types;

#[derive(Debug)]
pub struct Input {
pub game_id: Option<Uuid>,
pub env_id: Uuid,
pub tags: HashMap<String, String>,
}

Expand All @@ -33,11 +33,9 @@ pub async fn get(ctx: &OperationCtx, input: &Input) -> GlobalResult<Output> {
compression,
tags
FROM db_build.builds
WHERE
($2 IS NULL OR game_id = $2) AND
tags @> $1
WHERE env_id = $1 AND tags @> $2
",
input.game_id,
input.env_id,
serde_json::to_string(&input.tags)?,
)
.await?
Expand Down

0 comments on commit ad50f4a

Please sign in to comment.