Skip to content

Commit 2496c94

Browse files
committed
do pmh individually in reconcile
1 parent 6f7c0e4 commit 2496c94

1 file changed

Lines changed: 16 additions & 19 deletions

File tree

svc/util/insert.ts

Lines changed: 16 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1007,24 +1007,21 @@ export async function queueReconcile(
10071007
metricName: MetricName,
10081008
) {
10091009
if (gcMatch) {
1010-
await Promise.all(
1011-
gcMatch.players
1012-
.filter((p) =>
1013-
metricName === "pmh_gcdata"
1014-
? !Boolean(pgroup[p.player_slot]?.account_id)
1015-
: true,
1016-
)
1017-
.map(async (p) => {
1018-
if (p.account_id) {
1019-
const { rows } = await db.raw(
1020-
"INSERT INTO player_match_history(account_id, match_id, player_slot) VALUES (?, ?, ?) ON CONFLICT DO NOTHING RETURNING *",
1021-
[p.account_id, gcMatch.match_id, p.player_slot],
1022-
);
1023-
if (rows.length > 0) {
1024-
redisCount(metricName);
1025-
}
1026-
}
1027-
}),
1028-
);
1010+
const filtered = gcMatch.players
1011+
.filter((p) =>
1012+
metricName === "pmh_gcdata"
1013+
? !Boolean(pgroup[p.player_slot]?.account_id)
1014+
: true,
1015+
)
1016+
.filter(p => p.account_id);
1017+
for (let p of filtered) {
1018+
const { rows } = await db.raw(
1019+
"INSERT INTO player_match_history(account_id, match_id, player_slot) VALUES (?, ?, ?) ON CONFLICT DO NOTHING RETURNING *",
1020+
[p.account_id, gcMatch.match_id, p.player_slot],
1021+
);
1022+
if (rows.length > 0) {
1023+
redisCount(metricName);
1024+
}
1025+
}
10291026
}
10301027
}

0 commit comments

Comments
 (0)