diff --git a/packages/services/pegboard/src/ops/runner/find_dc_with_runner.rs b/packages/services/pegboard/src/ops/runner/find_dc_with_runner.rs index 5a583c3e2e..bd7cb41957 100644 --- a/packages/services/pegboard/src/ops/runner/find_dc_with_runner.rs +++ b/packages/services/pegboard/src/ops/runner/find_dc_with_runner.rs @@ -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)] @@ -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 {