hack to give backend 100ms to really get going

This commit is contained in:
Ted Unangst 2020-05-08 16:50:08 -04:00
parent 85270b9b69
commit 7e6d6acc5f
1 changed files with 11 additions and 0 deletions

11
web.go
View File

@ -2325,6 +2325,15 @@ func enditall() {
var preservehooks []func() var preservehooks []func()
func wait100ms() chan struct{} {
c := make(chan struct{})
go func() {
time.Sleep(100 * time.Millisecond)
close(c)
}()
return c
}
func serve() { func serve() {
db := opendatabase() db := opendatabase()
login.Init(db) login.Init(db)
@ -2337,6 +2346,7 @@ func serve() {
go enditall() go enditall()
go redeliverator() go redeliverator()
go tracker() go tracker()
w100 := wait100ms()
getconfig("debug", &debugMode) getconfig("debug", &debugMode)
readviews = templates.Load(debugMode, readviews = templates.Load(debugMode,
@ -2364,6 +2374,7 @@ func serve() {
} }
loadAvatarColors() loadAvatarColors()
} }
<-w100
for _, h := range preservehooks { for _, h := range preservehooks {
h() h()