Skip to content

Commit

Permalink
recache on parse
Browse files Browse the repository at this point in the history
  • Loading branch information
howardchung committed Jul 3, 2024
1 parent f16b44e commit ae7a3c9
Showing 1 changed file with 16 additions and 15 deletions.
31 changes: 16 additions & 15 deletions store/insert.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
});
}
}
}),
);
Expand Down

0 comments on commit ae7a3c9

Please sign in to comment.