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 <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
Agniva De Sarker 2018-11-12 11:39:05 +05:30 committed by Brad Fitzpatrick
parent 5f9a541373
commit c340431777
1 changed files with 5 additions and 1 deletions

View File

@ -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