mirror of
https://github.com/lukaszraczylo/go-simple-graphql.git
synced 2026-10-20 01:36:57 +00:00
fixup! Add missing retry mechanism. I have no idea how this was missed, but ho hum.
This commit is contained in:
@@ -80,10 +80,13 @@ func (c *BaseClient) Query(queryContent string, queryVariables interface{}, quer
|
|||||||
if len(queryHeaders) > 0 {
|
if len(queryHeaders) > 0 {
|
||||||
cacheBaseClient = reflect.ValueOf(*c).Interface().(BaseClient)
|
cacheBaseClient = reflect.ValueOf(*c).Interface().(BaseClient)
|
||||||
queryHeaders = c.parseQueryHeaders(queryHeaders)
|
queryHeaders = c.parseQueryHeaders(queryHeaders)
|
||||||
|
defer func() {
|
||||||
|
*c = cacheBaseClient
|
||||||
|
}()
|
||||||
}
|
}
|
||||||
|
|
||||||
if c.cache.enabled {
|
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)
|
c.Logger.Debug(c, "Hash calculated;", "hash:", queryHash)
|
||||||
|
|
||||||
cachedResponse = c.cacheLookup(queryHash)
|
cachedResponse = c.cacheLookup(queryHash)
|
||||||
@@ -111,10 +114,6 @@ func (c *BaseClient) Query(queryContent string, queryVariables interface{}, quer
|
|||||||
c.cache.client.Set(queryHash, jsonData)
|
c.cache.client.Set(queryHash, jsonData)
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(queryHeaders) > 0 {
|
|
||||||
*c = cacheBaseClient
|
|
||||||
}
|
|
||||||
|
|
||||||
return c.decodeResponse(jsonData), err
|
return c.decodeResponse(jsonData), err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user