From c3404317771e23bb54e22f9afec8cadd7ca6c940 Mon Sep 17 00:00:00 2001 From: Agniva De Sarker Date: Mon, 12 Nov 2018 11:39:05 +0530 Subject: [PATCH] cmd/godoc: start RunIndexer synchronously when index is present Until the index is read completely, search requests will serve an "indexing in progress" message. We make this synchronous to allow the index to be read completely before starting to serve requests. Fixes golang/go#24965 Change-Id: I6b094374a9c5cc923f0582107dde2b652e64fd96 Reviewed-on: https://go-review.googlesource.com/c/148998 Reviewed-by: Brad Fitzpatrick Run-TryBot: Brad Fitzpatrick TryBot-Result: Gobot Gobot --- cmd/godoc/appinit.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cmd/godoc/appinit.go b/cmd/godoc/appinit.go index 6318bb75..1f276d86 100644 --- a/cmd/godoc/appinit.go +++ b/cmd/godoc/appinit.go @@ -84,7 +84,11 @@ func main() { } corpus.IndexDirectory = indexDirectoryDefault corpus.InitVersionInfo() - go corpus.RunIndexer() + if indexFilenames != "" { + corpus.RunIndexer() + } else { + go corpus.RunIndexer() + } pres = godoc.NewPresentation(corpus) pres.TabWidth = 8