Fix app
This commit is contained in:
+8
-6
@@ -5,6 +5,8 @@ import (
|
||||
"os"
|
||||
"os/exec"
|
||||
"time"
|
||||
|
||||
"github.com/localhots/yeast/unit"
|
||||
)
|
||||
|
||||
type (
|
||||
@@ -13,19 +15,19 @@ type (
|
||||
|
||||
// XXX: We're about to spawn hundreds of Python processes
|
||||
func (s *Supervisor) StartAll() {
|
||||
for unit, _ := range Units {
|
||||
s.Start(unit)
|
||||
for _, name := range unit.Units() {
|
||||
s.Start(name)
|
||||
time.Sleep(500 * time.Millisecond) // Don't spawn processes too fast
|
||||
}
|
||||
}
|
||||
|
||||
func (s *Supervisor) Start(unit string) {
|
||||
fmt.Println("Starting unit: " + unit)
|
||||
func (s *Supervisor) Start(name string) {
|
||||
fmt.Println("Starting unit: " + name)
|
||||
conf := Conf().Python
|
||||
cmd := exec.Command(conf.BinPath, conf.WrapperPath, unit)
|
||||
cmd := exec.Command(conf.BinPath, conf.WrapperPath, name)
|
||||
cmd.Stdout = os.Stdout // Sorry
|
||||
if err := cmd.Start(); err != nil {
|
||||
fmt.Println("Failed to start unit: ", unit)
|
||||
fmt.Println("Failed to start unit: ", name)
|
||||
fmt.Println(err.Error())
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user