diff --git a/src/datasource/zabbix/proxy/cachingProxy.ts b/src/datasource/zabbix/proxy/cachingProxy.ts index caf983016..5c9a91e6d 100644 --- a/src/datasource/zabbix/proxy/cachingProxy.ts +++ b/src/datasource/zabbix/proxy/cachingProxy.ts @@ -100,9 +100,25 @@ function cacheRequest(func, funcName, funcScope, self) { }; } +//TODO: add type for the args function getRequestHash(args) { - const argsJson = JSON.stringify(args); - return getHash(argsJson); + try { + if (typeof args === 'object') { + args = Array.from(args || {}).map((arg: any) => { + if (arg?.scopedVars?.__sceneObject) { + const { scopedVars, ...rest } = arg; + const { __sceneObject, ...scopedVarsWithoutScenes } = scopedVars; + return { ...rest, scopedVars: scopedVarsWithoutScenes }; + } + return arg; + }); + } + const argsJson = JSON.stringify(args); + return getHash(argsJson); + } catch (ex) { + console.error(`failing to get the request hash for caching. type of args ${typeof args}`); + return 0; + } } function getHash(str: string): number {