From ae7a3c9f20c3508dac7e52fd46dc7bd8381e4874 Mon Sep 17 00:00:00 2001 From: Ubuntu Date: Wed, 3 Jul 2024 00:33:01 +0000 Subject: [PATCH] recache on parse --- store/insert.ts | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/store/insert.ts b/store/insert.ts index 62969c105..2e55c7afd 100644 --- a/store/insert.ts +++ b/store/insert.ts @@ -523,22 +523,23 @@ export async function insertMatch( if (config.ENABLE_PLAYER_CACHE) { await Promise.allSettled( match.players - .filter((p) => p.account_id) .map(async (p) => { - await cassandra.execute( - `DELETE FROM player_temp WHERE account_id = ?`, - [p.account_id], - { prepare: true }, - ); - // Auto-cache players - if ( - p.account_id && - await isAutoCachePlayer(redis, p.account_id) - ) { - await addJob({ - name: 'cacheQueue', - data: p.account_id.toString(), - }); + const account_id = pgroup[p.player_slot]?.account_id ?? p.account_id; + if (account_id) { + await cassandra.execute( + `DELETE FROM player_temp WHERE account_id = ?`, + [account_id], + { prepare: true }, + ); + // Auto-cache players + if ( + await isAutoCachePlayer(redis, account_id) + ) { + await addJob({ + name: 'cacheQueue', + data: account_id.toString(), + }); + } } }), );