Skip to content

Commit

Permalink
Log changed files during restarts
Browse files Browse the repository at this point in the history
This adds logging for file changes that trigger restarts. It should help
with debugging cases where Zeus appeared not to restart correctly.
  • Loading branch information
andrew-stripe committed Aug 25, 2016
1 parent 5a3314f commit 8000202
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 2 additions & 0 deletions go/processtree/processtree.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,15 @@ var restartMutex sync.Mutex
func (tree *ProcessTree) RestartNodesWithFeatures(files []string) {
restartMutex.Lock()
defer restartMutex.Unlock()
tree.Root.trace("%d files changed, beginning with %q", len(files), files[0])
tree.Root.restartNodesWithFeatures(tree, files)
}

// Serialized: restartMutex is always held when this is called.
func (node *SlaveNode) restartNodesWithFeatures(tree *ProcessTree, files []string) {
for _, file := range files {
if node.HasFeature(file) {
node.trace("restarting for %q", file)
node.RequestRestart()
return
}
Expand Down
4 changes: 3 additions & 1 deletion go/processtree/slavemonitor.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,9 @@ func StartSlaveMonitor(tree *ProcessTree, fileChanges <-chan []string, done chan
case fd := <-registeringFds:
go monitor.slaveDidBeginRegistration(fd)
case files := <-fileChanges:
tree.RestartNodesWithFeatures(files)
if len(files) > 0 {
tree.RestartNodesWithFeatures(files)
}
}
}
}()
Expand Down

0 comments on commit 8000202

Please sign in to comment.