rework backend exec to require less waiting

This commit is contained in:
Ted Unangst 2022-03-17 00:55:18 -04:00
parent f8c5667a0e
commit 5b26f405aa
2 changed files with 6 additions and 15 deletions

View File

@ -124,7 +124,9 @@ func runBackendServer() {
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()
}()
}

13
web.go
View File

@ -2420,15 +2420,6 @@ func enditall() {
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 @@ func serve() {
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 @@ func serve() {
}
loadAvatarColors()
}
<-w100
for _, h := range preservehooks {
h()