Skip to content

Commit

Permalink
simplified hash argument filtering
Browse files Browse the repository at this point in the history
  • Loading branch information
yesoreyeram committed Apr 29, 2024
1 parent 16e37ab commit f44309c
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions src/datasource/zabbix/proxy/cachingProxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,20 +104,13 @@ function cacheRequest(func, funcName, funcScope, self) {
function getRequestHash(args) {
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;
});
args = Array.from(args || {}).filter((arg: any) => !Boolean(arg?.scopedVars?.__sceneObject));
}
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;
return getHash(crypto.randomUUID());
}
}

Expand Down

0 comments on commit f44309c

Please sign in to comment.