address review comments

This commit is contained in:
Mahmood Ali
2019-07-02 14:53:50 +08:00
parent f3c944aaf5
commit 009f186eb7
2 changed files with 5 additions and 3 deletions

View File

@@ -132,7 +132,7 @@ func TestAllocRunner_Restore_RunningTerminal(t *testing.T) {
require.Equal(t, events[3].Type, structs.TaskTerminated)
}
// TestAllocRunner_Restore_Completed asserts that restoring a completed
// TestAllocRunner_Restore_CompletedBatch asserts that restoring a completed
// batch alloc doesn't run it again
func TestAllocRunner_Restore_CompletedBatch(t *testing.T) {
t.Parallel()

View File

@@ -401,9 +401,11 @@ func (tr *TaskRunner) Run() {
// if restoring a dead task, ensure that task is cleared and all post hooks
// are called without additional state updates
if dead {
// clear driver handle if it was successfully restored on
// already dead task
// do cleanup functions without emitting any additional events/work
// to handle cases where we restored a dead task where client terminated
// after task finished before completing post-run actions.
tr.clearDriverHandle()
tr.stateUpdater.TaskStateUpdated()
if err := tr.stop(); err != nil {
tr.logger.Error("stop failed on terminal task", "error", err)
}