Skip to content

Commit

Permalink
Run deployment garbage collector on an interval
Browse files Browse the repository at this point in the history
Fixes #3244
  • Loading branch information
dadgar committed Sep 25, 2017
1 parent 5c44105 commit 5db4f4c
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions nomad/leader.go
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,8 @@ func (s *Server) schedulePeriodic(stopCh chan struct{}) {
defer nodeGC.Stop()
jobGC := time.NewTicker(s.config.JobGCInterval)
defer jobGC.Stop()
deploymentGC := time.NewTicker(s.config.DeploymentGCInterval)
defer deploymentGC.Stop()

// getLatest grabs the latest index from the state store. It returns true if
// the index was retrieved successfully.
Expand Down Expand Up @@ -391,6 +393,10 @@ func (s *Server) schedulePeriodic(stopCh chan struct{}) {
if index, ok := getLatest(); ok {
s.evalBroker.Enqueue(s.coreJobEval(structs.CoreJobJobGC, index))
}
case <-deploymentGC.C:
if index, ok := getLatest(); ok {
s.evalBroker.Enqueue(s.coreJobEval(structs.CoreJobDeploymentGC, index))
}
case <-stopCh:
return
}
Expand Down

0 comments on commit 5db4f4c

Please sign in to comment.