Skip to content

Commit aac9634

Browse files
committed
fix(pegboard): validate drain_grace_period < request_lifespan
1 parent add44af commit aac9634

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

  • engine/packages/pegboard/src/ops/runner_config

engine/packages/pegboard/src/ops/runner_config/upsert.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ pub async fn pegboard_runner_config_upsert(ctx: &OperationCtx, input: &Input) ->
2929
RunnerConfigKind::Serverless {
3030
url,
3131
headers,
32+
request_lifespan,
3233
drain_grace_period,
3334
slots_per_runner,
3435
..
@@ -81,6 +82,15 @@ pub async fn pegboard_runner_config_upsert(ctx: &OperationCtx, input: &Input) ->
8182
.build());
8283
}
8384

85+
if *drain_grace_period >= *request_lifespan {
86+
return Err(errors::RunnerConfig::Invalid {
87+
reason: format!(
88+
"`drain_grace_period` must be less than `request_lifespan` ({drain_grace_period}s >= {request_lifespan}s)"
89+
),
90+
}
91+
.build());
92+
}
93+
8494
let actor_stop_threshold_ms = ctx.config().pegboard().actor_stop_threshold();
8595
let drain_grace_period_ms = i64::from(*drain_grace_period) * 1000;
8696
if drain_grace_period_ms > actor_stop_threshold_ms {

0 commit comments

Comments
 (0)