From 538ed41b00a641317b42637cedfacdaf69a737e8 Mon Sep 17 00:00:00 2001 From: Tim Gross Date: Tue, 1 Nov 2022 16:27:51 -0400 Subject: [PATCH] variables: limit rekey eval to half the nack timeout In order to limit how much the rekey job can monopolize a scheduler worker, we limit how long it can run to 1min before stopping work and emitting a new eval. But this exactly matches the default nack timeout, so it'll fail the eval rather than getting a chance to emit a new one. Set the timeout for the rekey eval to half the configured nack timeout. --- nomad/core_sched.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nomad/core_sched.go b/nomad/core_sched.go index 3936498537d3..f4e2aa48b3dc 100644 --- a/nomad/core_sched.go +++ b/nomad/core_sched.go @@ -1053,7 +1053,7 @@ func (c *CoreScheduler) rotateVariables(iter memdb.ResultIterator, eval *structs // // Instead, we'll rate limit RPC requests and have a timeout. If we still // haven't finished the set by the timeout, emit a new eval. - ctx, cancel := context.WithTimeout(context.Background(), 1*time.Minute) + ctx, cancel := context.WithTimeout(context.Background(), c.srv.GetConfig().EvalNackTimeout/2) defer cancel() limiter := rate.NewLimiter(rate.Limit(100), 100)