diff --git a/hyphae/count.go b/hyphae/count.go index 2c1d5f1..d090606 100644 --- a/hyphae/count.go +++ b/hyphae/count.go @@ -10,6 +10,13 @@ var count = struct { sync.Mutex }{} +// Set the value of hyphae count to zero. +func ResetCount() { + count.Lock() + count.value = 0 + count.Unlock() +} + // Increment the value of hyphae count. func IncrementCount() { count.Lock() diff --git a/main.go b/main.go index 9daa2cd..cf79b9f 100644 --- a/main.go +++ b/main.go @@ -70,6 +70,7 @@ func handlerReindex(w http.ResponseWriter, rq *http.Request) { log.Println("Rejected", rq.URL) return } + hyphae.ResetCount() HyphaStorage = make(map[string]*HyphaData) log.Println("Wiki storage directory is", WikiDir) log.Println("Start indexing hyphae...")