X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/949d940b5f75114f86d381c347f0ba8f26b3e9b9..233a2b6bd23a3e2054cfc0690f2bc06c0f9f7323:/lib/dispatchcloud/test/queue.go diff --git a/lib/dispatchcloud/test/queue.go b/lib/dispatchcloud/test/queue.go index e18a2b5362..6a6c952358 100644 --- a/lib/dispatchcloud/test/queue.go +++ b/lib/dispatchcloud/test/queue.go @@ -158,14 +158,21 @@ func (q *Queue) Update() error { // // The resulting changes are not exposed through Get() or Entries() // until the next call to Update(). -func (q *Queue) Notify(upd arvados.Container) { +// +// Return value is true unless the update is rejected (invalid state +// transition). +func (q *Queue) Notify(upd arvados.Container) bool { q.mtx.Lock() defer q.mtx.Unlock() for i, ctr := range q.Containers { if ctr.UUID == upd.UUID { - q.Containers[i] = upd - return + if ctr.State != arvados.ContainerStateComplete && ctr.State != arvados.ContainerStateCancelled { + q.Containers[i] = upd + return true + } + return false } } q.Containers = append(q.Containers, upd) + return true }