Skip to content

Commit

Permalink
sda
Browse files Browse the repository at this point in the history
  • Loading branch information
anshulpundir committed Jun 22, 2018
1 parent 5876480 commit 1852406
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions manager/orchestrator/taskreaper/task_reaper.go
Expand Up @@ -176,6 +176,17 @@ func (tr *TaskReaper) tick() {

defer func() {
tr.cleanup = nil

// Clean out the dirty set at the end of this tick iteration.
// When tick() finishes, the tasks in the slot were either cleaned up,
// or it was skipped because it didn't meet the criteria for cleaning.
// Either way, we can discard the dirty set because future events on that slot
// will cause the task to be readded to the dirty set at that point.
//
// TODO(anshul) The only edge case is when there are more than one running tasks present
// for a given slot. In that case, the slot may remain uncleaned until there is a task
// restart for that slot.
tr.dirty = nil
}()

deleteTasks := make(map[string]struct{})
Expand All @@ -188,9 +199,6 @@ func (tr *TaskReaper) tick() {
for dirty := range tr.dirty {
service := store.GetService(tx, dirty.ServiceID)
if service == nil {
// If the service can't be found, assume that it was deleted
// and remove the slot from the dirty list.
delete(tr.dirty, dirty)
continue
}

Expand Down Expand Up @@ -272,10 +280,6 @@ func (tr *TaskReaper) tick() {
break
}
}

if runningTasks <= 1 {
delete(tr.dirty, dirty)
}
}
})

Expand Down

0 comments on commit 1852406

Please sign in to comment.