Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions packages/services/pegboard/src/ops/runner/find_dc_with_runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use futures_util::{StreamExt, TryFutureExt, stream::FuturesUnordered};
use gas::prelude::*;
use rivet_api_types::runners::list as runners_list;
use rivet_api_util::{HeaderMap, Method, request_remote_datacenter};
use rivet_types::namespaces::RunnerConfig;
use serde::de::DeserializeOwned;

#[derive(Debug, Clone, Serialize, Deserialize)]
Expand Down Expand Up @@ -64,6 +65,23 @@ async fn find_dc_with_runner_inner(ctx: &OperationCtx, input: &Input) -> Result<
return Ok(Some(ctx.config().dc_label()));
}

// Check if serverless runner config exists
let res = ctx
.op(namespace::ops::runner_config::get_global::Input {
runners: vec![(input.namespace_id, input.runner_name.clone())],
})
.await?;
if let Some(runner) = res.first() {
match &runner.config {
RunnerConfig::Serverless { max_runners, .. } => {
// Check if runner config does not have a max runner count of 0
if *max_runners != 0 {
return Ok(Some(ctx.config().dc_label()));
}
}
}
}

// Get namespace
let namespace = ctx
.op(namespace::ops::get_global::Input {
Expand Down
Loading