From 207fb1271533d440546f3c3ad17b068ff752fe91 Mon Sep 17 00:00:00 2001 From: Bas950 Date: Sat, 21 Dec 2024 12:35:28 +0100 Subject: [PATCH] chore: heartbeat env variable --- apps/worker/src/v4/fields/heartbeat.ts | 28 ++++++++++++++------------ 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/apps/worker/src/v4/fields/heartbeat.ts b/apps/worker/src/v4/fields/heartbeat.ts index 295c00e4..d771d174 100644 --- a/apps/worker/src/v4/fields/heartbeat.ts +++ b/apps/worker/src/v4/fields/heartbeat.ts @@ -81,19 +81,21 @@ export async function resolver( // * Use Redis Hash with 'service' in the key to store heartbeat data const redisKey = `pmd-api.heartbeatUpdates.${params.identifier}`; - await redis.hset(redisKey, { - service: params.presence?.service, - version: params.presence?.version, - language: params.presence?.language, - since: params.presence?.since.toString(), - extension_version: params.extension.version, - extension_language: params.extension.language, - extension_connected_app: params.extension.connected?.app?.toString(), - extension_connected_discord: - params.extension.connected?.discord?.toString(), - ip_address: ip - }); - await redis.expire(redisKey, 300); + if (process.env.HEARTBEATS !== "false") { + await redis.hset(redisKey, { + service: params.presence?.service, + version: params.presence?.version, + language: params.presence?.language, + since: params.presence?.since.toString(), + extension_version: params.extension.version, + extension_language: params.extension.language, + extension_connected_app: params.extension.connected?.app?.toString(), + extension_connected_discord: + params.extension.connected?.discord?.toString(), + ip_address: ip + }); + await redis.expire(redisKey, 300); + } return { __typename: "HeartbeatResult",