From f44309cdd8a61ce4711945bbed8ddd326c72dad9 Mon Sep 17 00:00:00 2001 From: Sriramajeyam Sugumaran <153843+yesoreyeram@users.noreply.github.com> Date: Mon, 29 Apr 2024 11:30:31 +0100 Subject: [PATCH] simplified hash argument filtering --- src/datasource/zabbix/proxy/cachingProxy.ts | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/src/datasource/zabbix/proxy/cachingProxy.ts b/src/datasource/zabbix/proxy/cachingProxy.ts index 5c9a91e6..aac220af 100644 --- a/src/datasource/zabbix/proxy/cachingProxy.ts +++ b/src/datasource/zabbix/proxy/cachingProxy.ts @@ -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()); } }