Merge pull request #3267 from hashicorp/b-deployment-gc

Run deployment garbage collector on an interval
This commit is contained in:
Alex Dadgar
2017-09-25 11:05:06 -07:00
committed by GitHub
2 changed files with 7 additions and 0 deletions

View File

@@ -13,6 +13,7 @@ IMPROVEMENTS:
BUG FIXES:
* core: Fix restoration of stopped periodic jobs [GH-3201]
* core: Run deployment garbage collector on an interval [GH-3267]
* core: Fix issue where node-drain with complete batch allocation would create
replacement [GH-3217]
* core: Fix issue in which batch allocations from previous job versions may not

View File

@@ -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.
@@ -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
}