From f57c841b9321ac6fd354fcafbf780d28e9160cd9 Mon Sep 17 00:00:00 2001 From: Tim Gross Date: Thu, 9 Feb 2023 13:55:30 -0500 Subject: [PATCH] this is a write, not a read --- nomad/eval_broker.go | 4 ++-- nomad/eval_broker_test.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/nomad/eval_broker.go b/nomad/eval_broker.go index 0bfcdd9804b4..ca7907a1faa2 100644 --- a/nomad/eval_broker.go +++ b/nomad/eval_broker.go @@ -868,8 +868,8 @@ func (b *EvalBroker) Stats() *BrokerStats { // stale and ready to mark for canceling. The eval RPC will call this with a // batch size set to avoid sending overly large raft messages. func (b *EvalBroker) Cancelable(batchSize int) []*structs.Evaluation { - b.l.RLock() - defer b.l.RUnlock() + b.l.Lock() + defer b.l.Unlock() if batchSize > len(b.cancelable) { batchSize = len(b.cancelable) diff --git a/nomad/eval_broker_test.go b/nomad/eval_broker_test.go index cfc369c102c9..d86f9609548e 100644 --- a/nomad/eval_broker_test.go +++ b/nomad/eval_broker_test.go @@ -1569,7 +1569,7 @@ func TestEvalBroker_IntegrationTest(t *testing.T) { config := DefaultConfig() config.NumSchedulers = 2 - config.EvalReapCancelableInterval = 500 * time.Millisecond + config.EvalReapCancelableInterval = time.Second must.NoError(t, srv.Reload(config)) // assert that all but 2 evals were canceled and that the eval broker state @@ -1579,7 +1579,7 @@ func TestEvalBroker_IntegrationTest(t *testing.T) { must.Wait(t, wait.InitialSuccess( wait.Timeout(10*time.Second), - wait.Gap(50*time.Millisecond), + wait.Gap(100*time.Millisecond), wait.BoolFunc(func() bool { got = getEvalStatuses() return got[structs.EvalStatusComplete] == 2 &&