From 5ea9fa2911198dc2cd616afa126401507122407b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20H=C3=A4felfinger?= Date: Tue, 26 Feb 2019 22:55:45 +0100 Subject: [PATCH] optimized handling if no category is missing --- internal/app/category.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/internal/app/category.go b/internal/app/category.go index ce7f40e..40f3a63 100644 --- a/internal/app/category.go +++ b/internal/app/category.go @@ -21,6 +21,11 @@ func synchronizeCategories(context *AppContext, filesystemNodes map[string]*loca missingCategories := findMissingCategories(filesystemNodes, existingCategories) + if len(missingCategories) == 0 { + logrus.Infof("No categories missing!") + return nil + } + 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 sort.Strings(missingCategories) + logrus.Infof("Creating %d categories", len(missingCategories)) + for _, categoryKey := range missingCategories { logrus.Infof("Creating category %s", categoryKey)