From 6a990e76d6ab2798424905afa44040903ec52b6b Mon Sep 17 00:00:00 2001 From: Chris Ainsworth-Patrick Date: Tue, 6 Feb 2024 13:39:12 +0000 Subject: [PATCH] reinstate the check for existing results that accidentally got removed --- policy/data/gql_async.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/policy/data/gql_async.go b/policy/data/gql_async.go index f5dada2..aedac76 100644 --- a/policy/data/gql_async.go +++ b/policy/data/gql_async.go @@ -70,6 +70,10 @@ func NewAsyncDataSource( } func (ds AsyncDataSource) Query(ctx context.Context, queryName string, query string, variables map[string]interface{}, output interface{}) (*QueryResponse, error) { + if existingResult, ok := ds.asyncResults[queryName]; ok { + return &QueryResponse{}, edn.Unmarshal(existingResult.Data, output) + } + if len(ds.asyncResults) > 0 && !ds.multipleQuerySupport { ds.log.Debugf("skipping async query for query %s due to lack of multipleQuerySupport", queryName) return nil, nil // don't error, in case there is another applicable query executor down-chain