Finally - fixed the cache version for single query if its enabled via header.

This commit is contained in:
2023-04-08 03:25:33 +01:00
parent 841c136e71
commit 55182f2f3d
3 changed files with 73 additions and 8 deletions
+5 -2
View File
@@ -80,11 +80,14 @@ func (c *BaseClient) Query(queryContent string, queryVariables interface{}, quer
// Check for library specific headers
if len(queryHeaders) > 0 {
queryHeadersModified := c.parseQueryHeaders(queryHeaders)
queryHeadersModified := cacheBaseClient.parseQueryHeaders(queryHeaders)
// compare if there are any changes
if !reflect.DeepEqual(queryHeadersModified, queryHeaders) {
cacheBaseClient.Logger.Debug(cacheBaseClient, "Headers modified, creating a new client")
if cacheBaseClient.cache.enabled != c.cache.enabled && cacheBaseClient.cache.enabled {
cacheBaseClient.Logger.Debug(cacheBaseClient, "Switching cache on as per single-request header")
cacheBaseClient.enableCache()
}
}
}