Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run deployment garbage collector on an interval #3267

Merged
merged 1 commit into from
Sep 25, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
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