Skip to content

Commit

Permalink
fix(mm): skip prewarming ats if no nodes booted
Browse files Browse the repository at this point in the history
  • Loading branch information
NathanFlurry committed Jul 1, 2024
1 parent 70a7984 commit 492c5fa
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 27 deletions.
4 changes: 3 additions & 1 deletion svc/pkg/mm-config/ops/version-prepare/src/prewarm_ats.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,9 @@ pub async fn prewarm_ats_cache(
let mut vlan_ips_in_region = vlan_ips.iter().filter(|row| row.datacenter_id == region_id);
let vlan_ip_count = vlan_ips_in_region.clone().count() as i64;

ensure!(vlan_ip_count != 0, "no ats servers found");
if vlan_ip_count == 0 {
continue;
}

// Pass artifact URLs to the job
let parameters = prewarm_ctx
Expand Down
52 changes: 26 additions & 26 deletions svc/pkg/mm/ops/lobby-runtime-aggregate/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,32 +41,32 @@ async fn handle(
let region_rows = sql_fetch_all!(
[ctx, RegionRow]
"
SELECT
namespace_id,
region_id,
SUM(
CASE
-- Lobbies stopped during the query window
WHEN stop_ts > $2 AND stop_ts <= $3 THEN
stop_ts - GREATEST(create_ts, $2)
-- Lobbies created during the query window, these may already be stopped after query_end
WHEN create_ts > $2 AND create_ts <= $3 THEN
LEAST(stop_ts, $3) - create_ts
-- Lobbies still running that overlap with the query window
WHEN stop_ts IS NULL AND create_ts <= $3 THEN
$3 - create_ts
ELSE 0
END
) AS total_time
FROM db_mm_state.lobbies AS OF SYSTEM TIME '-5s'
WHERE namespace_id = ANY($1)
AND (
(stop_ts > $2 AND stop_ts <= $3)
OR (create_ts > $2 AND create_ts <= $3)
OR (stop_ts IS NULL AND create_ts <= $3)
)
GROUP BY namespace_id, region_id
",
SELECT
namespace_id,
region_id,
SUM(
CASE
-- Lobbies stopped during the query window
WHEN stop_ts > $2 AND stop_ts <= $3 THEN
stop_ts - GREATEST(create_ts, $2)
-- Lobbies created during the query window, these may already be stopped after query_end
WHEN create_ts > $2 AND create_ts <= $3 THEN
LEAST(stop_ts, $3) - create_ts
-- Lobbies still running that overlap with the query window
WHEN stop_ts IS NULL AND create_ts <= $3 THEN
$3 - create_ts
ELSE 0
END
) AS total_time
FROM db_mm_state.lobbies AS OF SYSTEM TIME '-5s'
WHERE namespace_id = ANY($1)
AND (
(stop_ts > $2 AND stop_ts <= $3)
OR (create_ts > $2 AND create_ts <= $3)
OR (stop_ts IS NULL AND create_ts <= $3)
)
GROUP BY namespace_id, region_id
",
&namespace_ids,
query_start,
query_end,
Expand Down

0 comments on commit 492c5fa

Please sign in to comment.