rework backend exec to require less waiting
Ted Unangst tedu@tedunangst.com
Thu, 17 Mar 2022 00:55:18 -0400
2 files changed,
6 insertions(+),
15 deletions(-)
M
backend.go
→
backend.go
@@ -124,7 +124,9 @@ err = proc.Start()
if err != nil { elog.Panicf("can't exec backend: %s", err) } - proc.Wait() - elog.Printf("lost the backend: %s", err) - w.Close() + go func() { + proc.Wait() + elog.Printf("lost the backend: %s", err) + w.Close() + }() }
M
web.go
→
web.go
@@ -2420,15 +2420,6 @@ }
var preservehooks []func() -func wait100ms() chan struct{} { - c := make(chan struct{}) - go func() { - time.Sleep(100 * time.Millisecond) - close(c) - }() - return c -} - func bgmonitor() { for { time.Sleep(50 * time.Minute)@@ -2443,13 +2434,12 @@ listener, err := openListener()
if err != nil { elog.Fatal(err) } - go runBackendServer() + runBackendServer() go enditall() go redeliverator() go tracker() go bgmonitor() loadLingo() - w100 := wait100ms() readviews = templates.Load(develMode, viewDir+"/views/honkpage.html",@@ -2482,7 +2472,6 @@ savedassetparams[s] = getassetparam(s)
} loadAvatarColors() } - <-w100 for _, h := range preservehooks { h()