Skip to content

Commit

Permalink
Merge pull request #1887 from tonistiigi/discard-delay
Browse files Browse the repository at this point in the history
solver: delay before discarding job
  • Loading branch information
tonistiigi authored Dec 11, 2020
2 parents a3b4036 + 1b271e0 commit 275dd40
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion solver/jobs.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down

0 comments on commit 275dd40

Please sign in to comment.