client: don't run alloc postrun during shutdown
This commit is contained in:
parent
d965a15490
commit
e43d33aa50
|
@ -270,6 +270,10 @@ func (ar *allocRunner) Run() {
|
|||
ar.runTasks()
|
||||
|
||||
POST:
|
||||
if ar.isShuttingDown() {
|
||||
return
|
||||
}
|
||||
|
||||
// Run the postrun hooks
|
||||
if err := ar.postrun(); err != nil {
|
||||
ar.logger.Error("postrun failed", "error", err)
|
||||
|
@ -859,6 +863,14 @@ func (ar *allocRunner) IsWaiting() bool {
|
|||
return ar.prevAllocWatcher.IsWaiting()
|
||||
}
|
||||
|
||||
// isShuttingDown returns true if the alloc runner is in a shutdown state
|
||||
// due to a call to Shutdown() or Destroy()
|
||||
func (ar *allocRunner) isShuttingDown() bool {
|
||||
ar.destroyedLock.Lock()
|
||||
defer ar.destroyedLock.Unlock()
|
||||
return ar.shutdownLaunched
|
||||
}
|
||||
|
||||
// DestroyCh is a channel that is closed when an allocrunner is closed due to
|
||||
// an explicit call to Destroy().
|
||||
func (ar *allocRunner) DestroyCh() <-chan struct{} {
|
||||
|
|
Loading…
Reference in a new issue