hack to give backend 100ms to really get going
Ted Unangst tedu@tedunangst.com
Fri, 08 May 2020 16:50:08 -0400
1 files changed,
11 insertions(+),
0 deletions(-)
jump to
M
web.go
→
web.go
@@ -2325,6 +2325,15 @@ }
var preservehooks []func() +func wait100ms() chan struct{} { + c := make(chan struct{}) + go func() { + time.Sleep(100 * time.Millisecond) + close(c) + }() + return c +} + func serve() { db := opendatabase() login.Init(db)@@ -2337,6 +2346,7 @@ go runBackendServer()
go enditall() go redeliverator() go tracker() + w100 := wait100ms() getconfig("debug", &debugMode) readviews = templates.Load(debugMode,@@ -2364,6 +2374,7 @@ savedassetparams[s] = getassetparam(s)
} loadAvatarColors() } + <-w100 for _, h := range preservehooks { h()