Skip to content

Commit

Permalink
removed scenes object from caching hash
Browse files Browse the repository at this point in the history
  • Loading branch information
yesoreyeram committed Apr 22, 2024
1 parent 96bc114 commit 45de617
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions src/datasource/zabbix/proxy/cachingProxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 45de617

Please sign in to comment.