From 7e6d6acc5f1d66735742e58f5512baf06e425fe5 Mon Sep 17 00:00:00 2001 From: Ted Unangst Date: Fri, 8 May 2020 16:50:08 -0400 Subject: [PATCH] hack to give backend 100ms to really get going --- web.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/web.go b/web.go index 3ce13c6..539972e 100644 --- a/web.go +++ b/web.go @@ -2325,6 +2325,15 @@ 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 serve() { db := opendatabase() login.Init(db) @@ -2337,6 +2346,7 @@ func serve() { go enditall() go redeliverator() go tracker() + w100 := wait100ms() getconfig("debug", &debugMode) readviews = templates.Load(debugMode, @@ -2364,6 +2374,7 @@ func serve() { } loadAvatarColors() } + <-w100 for _, h := range preservehooks { h()