Merge pull request #1887 from tonistiigi/discard-delay

solver: delay before discarding job
v0.8
Tõnis Tiigi 2020-12-10 22:08:10 -08:00 committed by GitHub
commit 275dd408ea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 1 deletions

View File

@ -527,7 +527,13 @@ func (j *Job) Discard() error {
st.mu.Unlock() 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 return nil
} }