1
0
mirror of https://github.com/osmarks/mycorrhiza.git synced 2025-01-05 17:40:26 +00:00

Categories: Clean up deleted category records

This commit is contained in:
Timur Ismagilov 2022-03-29 19:53:08 +03:00
parent 0446fc4794
commit b6cde49f9d

View File

@ -73,10 +73,16 @@ func RemoveHyphaFromCategory(hyphaName, catName string) {
mutex.Lock()
if node, ok := hyphaToCategories[hyphaName]; ok {
node.removeCategory(catName)
if len(node.categoryList) == 0 {
delete(hyphaToCategories, hyphaName)
}
}
if node, ok := categoryToHyphae[catName]; ok {
node.removeHypha(hyphaName)
if len(node.hyphaList) == 0 {
delete(categoryToHyphae, catName)
}
}
mutex.Unlock()
go saveToDisk()