Skip to content

Commit 21083aa

Browse files
MasterPtatoNathanFlurry
authored andcommitted
fix(serverless): check for runner config when looking for dc
1 parent 7133e7b commit 21083aa

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

packages/services/pegboard/src/ops/runner/find_dc_with_runner.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ use futures_util::{StreamExt, TryFutureExt, stream::FuturesUnordered};
55
use gas::prelude::*;
66
use rivet_api_types::runners::list as runners_list;
77
use rivet_api_util::{HeaderMap, Method, request_remote_datacenter};
8+
use rivet_types::namespaces::RunnerConfig;
89
use serde::de::DeserializeOwned;
910

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

68+
// Check if serverless runner config exists
69+
let res = ctx
70+
.op(namespace::ops::runner_config::get_global::Input {
71+
runners: vec![(input.namespace_id, input.runner_name.clone())],
72+
})
73+
.await?;
74+
if let Some(runner) = res.first() {
75+
match &runner.config {
76+
RunnerConfig::Serverless { max_runners, .. } => {
77+
// Check if runner config does not have a max runner count of 0
78+
if *max_runners != 0 {
79+
return Ok(Some(ctx.config().dc_label()));
80+
}
81+
}
82+
}
83+
}
84+
6785
// Get namespace
6886
let namespace = ctx
6987
.op(namespace::ops::get_global::Input {

0 commit comments

Comments
 (0)