Skip to content

Commit

Permalink
fix: node draining
Browse files Browse the repository at this point in the history
  • Loading branch information
MasterPtato committed Apr 23, 2024
1 parent 299df84 commit 1869e03
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 10 deletions.
3 changes: 2 additions & 1 deletion svc/pkg/cluster/worker/src/workers/server_drain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,8 @@ async fn inner(
&nomad_node_id,
models::NodeUpdateDrainRequest {
drain_spec: Some(Box::new(models::DrainSpec {
deadline: Some((pool.drain_timeout / 1000) as i64),
// In nanoseconds. `drain_timeout` must be below 292 years for this to not overflow
deadline: Some((pool.drain_timeout * 1000000) as i64),
ignore_system_jobs: None,
})),
mark_eligible: None,
Expand Down
6 changes: 3 additions & 3 deletions svc/pkg/load-test/standalone/mm-sustain/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use rand::prelude::*;
use rivet_operation::prelude::*;
use tokio::time::Instant;

const PARALLEL_WORKERS: usize = 1;
const PARALLEL_WORKERS: usize = 2;

#[tracing::instrument(skip_all)]
pub async fn run_from_env(_ts: i64) -> GlobalResult<()> {
Expand Down Expand Up @@ -50,8 +50,8 @@ pub async fn run_from_env(_ts: i64) -> GlobalResult<()> {
// lobby_group_config(build_id, region_id, "basic-4d1"),
// lobby_group_config(build_id, region_id, "basic-2d1"),
// lobby_group_config(build_id, region_id, "basic-1d1"),
lobby_group_config(build_id, region_id, "basic-1d2"),
lobby_group_config(build_id, region_id, "basic-1d4"),
// lobby_group_config(build_id, region_id, "basic-1d2"),
// lobby_group_config(build_id, region_id, "basic-1d4"),
lobby_group_config(build_id, region_id, "basic-1d8"),
lobby_group_config(build_id, region_id, "basic-1d16"),
],
Expand Down
5 changes: 0 additions & 5 deletions svc/pkg/mm/util/src/key.rs
Original file line number Diff line number Diff line change
Expand Up @@ -203,11 +203,6 @@ pub fn player_auto_remove() -> String {
"{global}:mm:player:auto_remove".to_string()
}

/// is closed
pub fn node_is_closed(node_id: &str) -> String {
format!("{{global}}:mm:node:{}:is_closed", node_id,)
}

// Placeholder key
pub fn empty() -> String {
"{global}".to_string()
Expand Down
3 changes: 2 additions & 1 deletion svc/pkg/nomad/standalone/monitor/src/monitors/node_drain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,12 @@ pub async fn handle(
let meta = unwrap_ref!(node.meta, "no metadata on node");
let server_id = util::uuid::parse(unwrap!(meta.get("server-id"), "no server-id in metadata"))?;

tracing::info!(%node_id, %server_id, "node message");

if let Some(events) = &node.events {
// Check if the last message in the node events is a drain complete message
let is_last_drain_complete_message = events
.last()
.filter(|event| event.details.is_none())
.and_then(|event| event.message.as_ref())
.map(|msg| msg == "Node drain complete")
.unwrap_or_default();
Expand Down

0 comments on commit 1869e03

Please sign in to comment.