add extra protection from null

This commit is contained in:
lowkeynicc
2024-08-12 21:33:09 -04:00
parent d66a7c0042
commit ea4fe97bad

View File

@@ -129,11 +129,11 @@ const writeToDlobRedis = async (userPnlMap: UserPnlMap): Promise<boolean> => {
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(