Delete on increment and add a safety guard
This commit is contained in:
parent
3dc0e38feb
commit
48ab2a6c6a
|
@ -203,6 +203,7 @@ func (d *dockerCoordinator) IncrementImageReference(id, image string) {
|
|||
if cancel, ok := d.deleteFuture[id]; ok {
|
||||
d.logger.Printf("[DEBUG] driver.docker: cancelling removal of image %q", image)
|
||||
cancel()
|
||||
delete(d.deleteFuture, id)
|
||||
}
|
||||
d.imageLock.Unlock()
|
||||
}
|
||||
|
@ -229,6 +230,13 @@ func (d *dockerCoordinator) RemoveImage(id string) {
|
|||
return
|
||||
}
|
||||
|
||||
// This should never be the case but we safefty guard so we don't leak a
|
||||
// cancel.
|
||||
if cancel, ok := d.deleteFuture[id]; ok {
|
||||
d.logger.Printf("[ERR] driver.docker: image id %q has lingering delete future", id)
|
||||
cancel()
|
||||
}
|
||||
|
||||
// Setup a future to delete the image
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
d.deleteFuture[id] = cancel
|
||||
|
|
Loading…
Reference in a new issue