From ea4fe97bad61d78a2bbc88eb242abfe6deecabb1 Mon Sep 17 00:00:00 2001 From: lowkeynicc Date: Mon, 12 Aug 2024 21:33:09 -0400 Subject: [PATCH] add extra protection from null --- src/scripts/publishUnsettledPnlUsers.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/scripts/publishUnsettledPnlUsers.ts b/src/scripts/publishUnsettledPnlUsers.ts index 2ef51e8..e68e59f 100644 --- a/src/scripts/publishUnsettledPnlUsers.ts +++ b/src/scripts/publishUnsettledPnlUsers.ts @@ -129,11 +129,11 @@ const writeToDlobRedis = async (userPnlMap: UserPnlMap): Promise => { await Promise.all([ dlobRedisClient.setRaw( gainersRedisKey, - JSON.stringify(userPnlMap[perpMarketIndex].gain) + JSON.stringify(userPnlMap[perpMarketIndex].gain ?? []) ), dlobRedisClient.setRaw( losersRedisKey, - JSON.stringify(userPnlMap[perpMarketIndex].loss) + JSON.stringify(userPnlMap[perpMarketIndex].loss ?? []) ), ]).then(([_winnersResult, _losersResult]) => { logger.info(