optimized handling if no category is missing

This commit is contained in:
Philipp Häfelfinger 2019-02-26 22:55:45 +01:00
parent 9e20d4ecc2
commit 5ea9fa2911

View File

@ -21,6 +21,11 @@ func synchronizeCategories(context *AppContext, filesystemNodes map[string]*loca
missingCategories := findMissingCategories(filesystemNodes, existingCategories) missingCategories := findMissingCategories(filesystemNodes, existingCategories)
if len(missingCategories) == 0 {
logrus.Infof("No categories missing!")
return nil
}
return createMissingCategories(context, missingCategories, existingCategories) return createMissingCategories(context, missingCategories, existingCategories)
} }
@ -50,6 +55,8 @@ func createMissingCategories(context *AppContext, missingCategories []string, ex
// in the right order and we have the parent available while creating the children // in the right order and we have the parent available while creating the children
sort.Strings(missingCategories) sort.Strings(missingCategories)
logrus.Infof("Creating %d categories", len(missingCategories))
for _, categoryKey := range missingCategories { for _, categoryKey := range missingCategories {
logrus.Infof("Creating category %s", categoryKey) logrus.Infof("Creating category %s", categoryKey)