From 43eb92c395786e4fcf8d9d5da60195e37c5b4a78 Mon Sep 17 00:00:00 2001 From: Alexander Zobnin Date: Mon, 9 Sep 2024 13:17:23 +0200 Subject: [PATCH] Use list and search in less cases --- pkg/services/dashboards/service/zanzana.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/pkg/services/dashboards/service/zanzana.go b/pkg/services/dashboards/service/zanzana.go index 6d3fbe91c8a..f42155d2480 100644 --- a/pkg/services/dashboards/service/zanzana.go +++ b/pkg/services/dashboards/service/zanzana.go @@ -18,6 +18,7 @@ import ( const ( maxListQueryLength = 8 + maxListQueryLimit = 100 ) type searchResult struct { @@ -96,6 +97,15 @@ type findDashboardsFn func(ctx context.Context, query *dashboards.FindPersistedD // getFindDashboardsFn makes a decision which search method should be used func (dr *DashboardServiceImpl) getFindDashboardsFn(query *dashboards.FindPersistedDashboardsQuery) findDashboardsFn { + if query.Limit > 0 && query.Limit < maxListQueryLimit { + return dr.findDashboardsZanzanaCheck + } + if len(query.DashboardUIDs) > 0 && len(query.DashboardUIDs) < maxListQueryLimit { + return dr.findDashboardsZanzanaCheck + } + if len(query.FolderUIDs) > 0 && len(query.FolderUIDs) < maxListQueryLimit { + return dr.findDashboardsZanzanaCheck + } if len(query.Title) <= maxListQueryLength { return dr.findDashboardsZanzanaList }