diff --git a/pkg/services/sqlstore/annotation_cleanup.go b/pkg/services/sqlstore/annotation_cleanup.go index 78227366530..0f9a181777b 100644 --- a/pkg/services/sqlstore/annotation_cleanup.go +++ b/pkg/services/sqlstore/annotation_cleanup.go @@ -47,8 +47,9 @@ func (acs *AnnotationCleanupService) CleanAnnotations(ctx context.Context, cfg * if err != nil { return totalCleanedAnnotations, 0, err } - - affected, err = acs.cleanOrphanedAnnotationTags(ctx) + if totalCleanedAnnotations > 0 { + affected, err = acs.cleanOrphanedAnnotationTags(ctx) + } return totalCleanedAnnotations, affected, err }