Skip to content

Commit

Permalink
fix: fixed linter errors in client/service_manager
Browse files Browse the repository at this point in the history
  • Loading branch information
antklim committed Jul 30, 2021
1 parent 72a05bf commit 5a5ef03
Showing 1 changed file with 8 additions and 15 deletions.
23 changes: 8 additions & 15 deletions client/service_manager.go
Expand Up @@ -35,29 +35,22 @@ func (s *ServiceManager) Setup() {
// addServiceMonitor watches a channel to add services into operation.
func (s *ServiceManager) addServiceMonitor() {
log.Println("[DEBUG] starting service creation monitor")
for {
select {
case p := <-s.commandCreatedChan:
if p != nil && p.Process != nil {
s.processMap.Set(p.Process.Pid, p)
}
for p := range s.commandCreatedChan {
if p != nil && p.Process != nil {
s.processMap.Set(p.Process.Pid, p)
}
}
}

// removeServiceMonitor watches a channel to remove services from operation.
func (s *ServiceManager) removeServiceMonitor() {
log.Println("[DEBUG] starting service removal monitor")
var p *exec.Cmd
for {
select {
case p = <-s.commandCompleteChan:
if p != nil && p.Process != nil {
if err := p.Process.Signal(os.Interrupt); err != nil {
log.Println("[ERROR] service removal monitor failed to process signal:", err)
}
s.processMap.Delete(p.Process.Pid)
for p := range s.commandCompleteChan {
if p != nil && p.Process != nil {
if err := p.Process.Signal(os.Interrupt); err != nil {
log.Println("[ERROR] service removal monitor failed to process signal:", err)
}
s.processMap.Delete(p.Process.Pid)
}
}
}
Expand Down

0 comments on commit 5a5ef03

Please sign in to comment.