Skip to content

Commit

Permalink
fix: remove /join regression
Browse files Browse the repository at this point in the history
  • Loading branch information
MasterPtato committed Apr 17, 2024
1 parent d7b27d7 commit c53b1b8
Show file tree
Hide file tree
Showing 6 changed files with 4 additions and 21 deletions.
3 changes: 0 additions & 3 deletions svc/pkg/mm/util/src/key.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,6 @@ pub mod lobby_config {
pub is_custom: bool,
#[serde(rename = "st", skip_serializing_if = "Option::is_none")]
pub state_json: Option<String>,
#[serde(rename = "nc")]
pub is_node_closed: bool,
}

pub const NAMESPACE_ID: &str = "ns";
Expand All @@ -77,7 +75,6 @@ pub mod lobby_config {
pub const IS_CLOSED: &str = "c";
pub const IS_CUSTOM: &str = "cu";
pub const STATE_JSON: &str = "st";
pub const IS_NODE_CLOSED: &str = "nc";
}

/// HASH
Expand Down
9 changes: 0 additions & 9 deletions svc/pkg/mm/worker/redis-scripts/lobby_find.lua
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,6 @@ if query.kind.direct ~= nil then
return { 'err', 'LOBBY_NOT_FOUND' }
end

-- Check that lobby and node are not closed
local config_keys = redis.call('HMGET', key_direct_lobby_config, 'c', 'nc')
local is_closed = config_keys[1] == '1'
local is_node_closed = config_keys[2] == '1'

if is_closed or is_node_closed then
return {'err', 'LOBBY_CLOSED'}
end

-- Get max player count
local max_player_count = nil
if query.join_kind == 'direct' then
Expand Down
8 changes: 3 additions & 5 deletions svc/pkg/mm/worker/redis-scripts/nomad_node_closed_set.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,11 @@ for i=1,lobby_count do
local lobby_id = ARGV[real_i * 3 + 2]
local max_players_normal = tonumber(ARGV[real_i * 3 + 3])
local max_players_party = tonumber(ARGV[real_i * 3 + 4])

local key_lobby_config = KEYS[real_i * 4 + 2]

redis.call('HSET', key_lobby_config, 'nc', 0)


local is_closed = redis.call('HGET', key_lobby_config, 'c')

-- Don't modify closed lobbies
if is_closed ~= '1' then
local key_lobby_player_ids = KEYS[real_i * 4 + 3]
Expand Down
1 change: 0 additions & 1 deletion svc/pkg/mm/worker/src/workers/lobby_create/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,6 @@ async fn worker(ctx: &OperationContext<mm::msg::lobby_create::Message>) -> Globa
ready_ts: None,
is_custom: ctx.is_custom,
state_json: None,
is_node_closed: false,
})?)
.arg(ctx.ts() + util_mm::consts::LOBBY_READY_TIMEOUT)
.key(key::lobby_config(lobby_id))
Expand Down
1 change: 0 additions & 1 deletion svc/pkg/mm/worker/src/workers/lobby_find/find.rs
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,6 @@ pub async fn find(
is_closed: false,
is_custom: false,
state_json: None,
is_node_closed: false,
},
ready_expire_ts: ctx.ts() + util_mm::consts::LOBBY_READY_TIMEOUT,
})
Expand Down
3 changes: 1 addition & 2 deletions svc/pkg/mm/worker/src/workers/nomad_node_closed_set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,7 @@ async fn worker(
util_mm::JoinKind::Party,
),
lobby.lobby_id.to_string(),
)
.hset(util_mm::key::lobby_config(lobby.lobby_id), "nc", 1);
);
}

pipe.query_async(&mut ctx.redis_mm().await?).await?;
Expand Down

0 comments on commit c53b1b8

Please sign in to comment.