From 5a222aa3160abf12de806bba719055160c4fd00c Mon Sep 17 00:00:00 2001 From: Lukasz Raczylo Date: Sat, 8 Apr 2023 02:09:18 +0100 Subject: [PATCH] fixup! Add missing retry mechanism. I have no idea how this was missed, but ho hum. --- query.go | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/query.go b/query.go index b6de6db..dfb21d1 100644 --- a/query.go +++ b/query.go @@ -80,10 +80,13 @@ func (c *BaseClient) Query(queryContent string, queryVariables interface{}, quer if len(queryHeaders) > 0 { cacheBaseClient = reflect.ValueOf(*c).Interface().(BaseClient) queryHeaders = c.parseQueryHeaders(queryHeaders) + defer func() { + *c = cacheBaseClient + }() } if c.cache.enabled { - queryHash = strutil.Md5(query.compiledQuery) + queryHash = strutil.Md5(fmt.Sprintf("%s-%+v", query.compiledQuery, queryHeaders)) c.Logger.Debug(c, "Hash calculated;", "hash:", queryHash) cachedResponse = c.cacheLookup(queryHash) @@ -111,10 +114,6 @@ func (c *BaseClient) Query(queryContent string, queryVariables interface{}, quer c.cache.client.Set(queryHash, jsonData) } - if len(queryHeaders) > 0 { - *c = cacheBaseClient - } - return c.decodeResponse(jsonData), err }