From 1b271e0014f3a761dee3be45f881ccfe81efd60e Mon Sep 17 00:00:00 2001 From: Tonis Tiigi Date: Wed, 9 Dec 2020 20:45:55 -0800 Subject: [PATCH] solver: delay before discarding job Signed-off-by: Tonis Tiigi --- solver/jobs.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/solver/jobs.go b/solver/jobs.go index 67f1a30f94dd..806cec257749 100644 --- a/solver/jobs.go +++ b/solver/jobs.go @@ -527,7 +527,13 @@ func (j *Job) Discard() error { st.mu.Unlock() } - delete(j.list.jobs, j.id) + go func() { + // don't clear job right away. there might still be a status request coming to read progress + time.Sleep(10 * time.Second) + j.list.mu.Lock() + defer j.list.mu.Unlock() + delete(j.list.jobs, j.id) + }() return nil }