Skip to content

Commit

Permalink
back out PreKill changes
Browse files Browse the repository at this point in the history
  • Loading branch information
tgross committed Dec 2, 2021
1 parent 25fbf9f commit b99b090
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion client/allocrunner/alloc_runner_hooks.go
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ func (ar *allocRunner) preKillHooks() {
ar.logger.Trace("running alloc pre shutdown hook", "name", name, "start", start)
}

pre.PreKill(ar.alloc)
pre.PreKill()

if ar.logger.IsTrace() {
end := time.Now()
Expand Down
8 changes: 4 additions & 4 deletions client/allocrunner/groupservice_hook.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,18 +168,18 @@ func (h *groupServiceHook) PreTaskRestart() error {
h.mu.Unlock()
}()

h.preKillLocked(nil)
h.preKillLocked()
return h.prerunLocked()
}

func (h *groupServiceHook) PreKill(alloc *structs.Allocation) {
func (h *groupServiceHook) PreKill() {
h.mu.Lock()
defer h.mu.Unlock()
h.preKillLocked(alloc)
h.preKillLocked()
}

// implements the PreKill hook but requires the caller hold the lock
func (h *groupServiceHook) preKillLocked(alloc *structs.Allocation) {
func (h *groupServiceHook) preKillLocked() {
// If we have a shutdown delay deregister group services and then wait
// before continuing to kill tasks.
h.deregister()
Expand Down
2 changes: 1 addition & 1 deletion client/allocrunner/interfaces/runner_lifecycle.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ type RunnerPrerunHook interface {
type RunnerPreKillHook interface {
RunnerHook

PreKill(*structs.Allocation)
PreKill()
}

// RunnerPostrunHooks are executed after calling TaskRunner.Run, even for
Expand Down

0 comments on commit b99b090

Please sign in to comment.