Skip to content

Commit

Permalink
Sync allocation state before waiting for a destroy
Browse files Browse the repository at this point in the history
This change ensures that the client syncs allocation state with the
servers before entering its wait loop for the allocation to be
destroyed.

Fixes #2563
  • Loading branch information
dadgar committed Apr 14, 2017
1 parent 8ea220f commit 3018ae0
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions client/alloc_runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -578,14 +578,15 @@ func (r *AllocRunner) destroyTaskRunners(destroyEvent *structs.TaskEvent) {
for _, tr := range runners {
<-tr.WaitCh()
}

// Final state sync
r.syncStatus()
}

// handleDestroy blocks till the AllocRunner should be destroyed and does the
// necessary cleanup.
func (r *AllocRunner) handleDestroy() {
// Final state sync. We do this to ensure that the server has the correct
// state as we wait for a destroy.
r.syncStatus()

for {
select {
case <-r.destroyCh:
Expand Down

0 comments on commit 3018ae0

Please sign in to comment.