mirror of
https://github.com/lukaszraczylo/go-simple-graphql.git
synced 2026-10-12 00:45:31 +00:00
fixup! Add randomisation test for cache concurrency.
This commit is contained in:
@@ -92,7 +92,7 @@ func (c *BaseClient) Query(queryContent string, queryVariables interface{}, quer
|
||||
queryHash = strutil.Md5(fmt.Sprintf("%s-%+v", query.compiledQuery, queryHeaders))
|
||||
cacheBaseClient.Logger.Debug(cacheBaseClient, "Hash calculated;", "hash:", queryHash)
|
||||
|
||||
cachedResponse = cacheBaseClient.cacheLookup(queryHash)
|
||||
cachedResponse = c.cacheLookup(queryHash)
|
||||
if cachedResponse != nil {
|
||||
cacheBaseClient.Logger.Debug(cacheBaseClient, "Found cached response")
|
||||
return cacheBaseClient.decodeResponse(cachedResponse), nil
|
||||
@@ -113,8 +113,8 @@ func (c *BaseClient) Query(queryContent string, queryVariables interface{}, quer
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if cacheBaseClient.cache.enabled {
|
||||
cacheBaseClient.cache.client.Set(queryHash, jsonData)
|
||||
if cacheBaseClient.cache.enabled && jsonData != nil && queryHash != "" {
|
||||
c.cache.client.Set(queryHash, jsonData)
|
||||
}
|
||||
|
||||
return cacheBaseClient.decodeResponse(jsonData), err
|
||||
|
||||
Reference in New Issue
Block a user