all repos — honk @ 41deae42c872cab5b3758e610a0564a5137e8644

my fork of honk

rework backend exec to require less waiting
Ted Unangst tedu@tedunangst.com
Thu, 17 Mar 2022 00:55:18 -0400
commit

41deae42c872cab5b3758e610a0564a5137e8644

parent

8020df1d08dffa2385f614b9f81f4eaffbb92077

2 files changed, 6 insertions(+), 15 deletions(-)

jump to
M backend.gobackend.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.goweb.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()