1
0
mirror of https://github.com/osmarks/mycorrhiza.git synced 2024-12-12 05:20:26 +00:00

Fix hyphae count corruption on reindexation

This commit is contained in:
bouncepaw 2021-01-24 12:06:37 +05:00
parent 100f5ada92
commit 455a3e0f79
2 changed files with 8 additions and 0 deletions

View File

@ -10,6 +10,13 @@ var count = struct {
sync.Mutex 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. // Increment the value of hyphae count.
func IncrementCount() { func IncrementCount() {
count.Lock() count.Lock()

View File

@ -70,6 +70,7 @@ func handlerReindex(w http.ResponseWriter, rq *http.Request) {
log.Println("Rejected", rq.URL) log.Println("Rejected", rq.URL)
return return
} }
hyphae.ResetCount()
HyphaStorage = make(map[string]*HyphaData) HyphaStorage = make(map[string]*HyphaData)
log.Println("Wiki storage directory is", WikiDir) log.Println("Wiki storage directory is", WikiDir)
log.Println("Start indexing hyphae...") log.Println("Start indexing hyphae...")